我有一个moduleA,需要在moduleB的ViewModel中执行代码。所以我在我的基础设施中创建了一个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; }
}
}
我错过了委托命令中的函数定义
showOrderDetailsCommand = new DelegateCommand(ShowOrderDetailsView, SubmitAllCanExecute);