Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# PRISM WPF CompositeCommand执行方法不工作_C#_Wpf_Prism - Fatal编程技术网

C# PRISM WPF CompositeCommand执行方法不工作

C# PRISM WPF CompositeCommand执行方法不工作,c#,wpf,prism,C#,Wpf,Prism,我有一个moduleA,它需要在moduleB的ViewModel中执行代码。因此,我在我的基础设施中创建了一个commandProxy,并在moduleB中注册了一个命令。当我在proxy命令上调用Execute时,注册的命令不会执行。我应该如何进行调试 模 commandProxy.ShowOrderCommand.Execute(""); // I can see the registered command in the debugger //This is obtained throu

我有一个moduleA,它需要在moduleB的ViewModel中执行代码。因此,我在我的基础设施中创建了一个commandProxy,并在moduleB中注册了一个命令。当我在proxy命令上调用Execute时,注册的命令不会执行。我应该如何进行调试

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

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=新的DelegateCommand(ShowOrderDetailsView,SubmitAllCanExecute)

您不能使用
EventAggregators
而不是命令吗。您可以订阅模块B中的事件,并在需要时从模块A发布该事件。这比在适当的位置使用命令容易得多。