public MainWindowViewModel(IContainerExtension container, IEventAggregator eventAggregator) { _appData = container.Resolve <AppData>(); _eventAggregator = eventAggregator; _eventAggregator.GetEvent <AddToMineUtilsEvent>().Subscribe(AddToMineUtils); _eventAggregator.GetEvent <DeleteFromMineUtilsEvent>().Subscribe(DeleteFromMineUtils); _eventAggregator.GetEvent <RefreshMineUtilsEvent>().Subscribe(RefreshMineUtils); _moveMineUtilsEvent = _eventAggregator.GetEvent <MoveMineUtilsEvent>(); _moveMineUtilsEvent.Subscribe(MoveMineUtils, ThreadOption.PublisherThread, false, p => p.Token == 0); SettingCommand = new DelegateCommand(OpenSetting); UtilsCommand = new DelegateCommand(OpenUtils); RunUtilCommand = new DelegateCommand <UtilViewModel>(RunUtil); ExpandOrCollapseCommand = new DelegateCommand(ExpandOrCollapse); CollapseCommand = new DelegateCommand(Collapse); ClosingCommand = new DelegateCommand <CancelEventArgs>(Closing); }
public UtilControlViewModel(IContainerExtension container, IEventAggregator eventAggregator) { _utilData = container.Resolve <AppData>().UtilsData; _eventAggregator = eventAggregator; _eventAggregator.GetEvent <AddUtilEvent>().Subscribe(AddUtil); _addToMineUtilsEvent = _eventAggregator.GetEvent <AddToMineUtilsEvent>(); _deleteFromMineUtilsEvent = _eventAggregator.GetEvent <DeleteFromMineUtilsEvent>(); _moveMineUtilsEvent = _eventAggregator.GetEvent <MoveMineUtilsEvent>(); _moveMineUtilsEvent.Subscribe(MoveMineUtils, ThreadOption.PublisherThread, false, p => p.Token == 1); DeleteFromMineCommand = new DelegateCommand <UtilViewModel>(DeleteUtilModelFromMine); DeleteFromAllCommand = new DelegateCommand <UtilViewModel>(DeleteUtilModelFromAll); AddToMineCommand = new DelegateCommand <UtilViewModel>(AddToMine); OpenAddUtilByTypeCommand = new DelegateCommand <UtilType?>(OpenAddUtilByType); OpenAddUtilCommand = new DelegateCommand(OpenAddUtil); }