PRISM WPF CompositeCommand执行方法不起作用

时间:2015-10-21 13:01:18

标签: c# wpf prism

我有一个需要在moduleB的ViewModel中执行代码的moduleA。所以我在我的基础架构中创建了一个commandProxy,并在moduleB中注册了一个命令。当我在proxyCommand上调用Execute时,注册的命令不会执行。我该如何进行调试?

ModuleA

commandProxy.ShowOrderCommand.Execute(""); // I can see the registered command in the debugger
//This is obtained through constructor injection

ModuleB

showOrderDetailsCommand = new DelegateCommand(() => { }, SubmitAllCanExecute);
commandProxy.ShowOrderCommand.RegisterCommand(showOrderDetailsCommand);

private void ShowOrderDetailsView()
        {
            _regionManager.RequestNavigate(RegionNames.SecondaryRegion, new Uri("/TradeLogView", UriKind.Relative));
        }

基础设施

private static CompositeCommand showOrderDetailsCommand = new CompositeCommand(true);

public class PostMatchCommandProxy
    {
        virtual public CompositeCommand ShowOrderCommand
        {
            get { return ShowOrderDetailsCommand; }
        }
    }

1 个答案:

答案 0 :(得分:1)

我错过了委托命令

中的函数定义

showOrderDetailsCommand = new DelegateCommand(ShowOrderDetailsView,SubmitAllCanExecute);