解决Prism的EventAggregator的事件订阅错误

在prism的EventAggregator事件订阅会指向一个方法,而该方法不能为private,否则该事件订阅将会无法方法该方法导致订阅错误!正确做法是将指向的方法改为public

 

[ImportingConstructor]
        public ApplicationViewModel(IEventAggregator eventAggregator, IRegionManager regionManager)
        {
            this.EventAggregator = eventAggregator;
            this.RegionManager = regionManager;
            this.EventAggregator.GetEvent<ModuleChangedEvent>().Subscribe(OnLoading, ThreadOption.UIThread);
        }

 

public void OnLoading(SYS_MODULE curModule)
        {
            this.IsBusy = true;
            EntityQuery<SYS_APPLICATIONS> list = this.AuthenticationContext.GetSYS_APPLICATIONSQuery().Where(p => p.A_MODULEID == curModule.MODULEID);
            LoadOperation<SYS_APPLICATIONS> loadop = this.AuthenticationContext.Load(list);
            loadop.Completed += new EventHandler(loadop_Completed);
 
        }

 

posted on 2012-02-27 00:29  oldkingsir  阅读(610)  评论(0编辑  收藏  举报

导航