public EventsViewModel(IDispatcher dispacher, IApplicationEventBus eventBus, INavigator navigator, IPreDisplayEventViewItemStore preDisplayEventViewItemStore) { if (dispacher == null) { throw new ArgumentNullException("dispacher"); } if (eventBus == null) { throw new ArgumentNullException("eventBus"); } if (navigator == null) { throw new ArgumentNullException("navigator"); } if (preDisplayEventViewItemStore == null) { throw new ArgumentNullException("preDisplayEventViewItemStore"); } _dispacher = dispacher; _eventBus = eventBus; _navigator = navigator; PauseResume = new RelayCommand(OnPauseResume); Clear = new RelayCommand(OnClear); _dispacher.Background(() => { _eventBus.Subscribe(this); preDisplayEventViewItemStore.Unload(this); }); }
public ComponentsViewModel( INavigator navigator, IHistoricalItemStore <Component> components, IHistoricalItemStore <RegistrationSource> registrationSources, IApplicationEventBus applicationEventBus, IDispatcher dispatcher) { _navigator = navigator; _applicationEventBus = applicationEventBus; _dispatcher = dispatcher; _filteredSortedComponents = new ListCollectionView(_components); _filteredSortedComponents.SortDescriptions.Add(new SortDescription("Description", ListSortDirection.Ascending)); dispatcher.Background(() => { _applicationEventBus.Subscribe(this); var vms = new List <object>(); vms.AddRange(components.GetItems().Select(CreateViewModel)); vms.AddRange(registrationSources.GetItems().Select(CreateViewModel)); dispatcher.Foreground(() => { foreach (var vm in vms) { _components.Add(vm); } }); }); }
public SessionViewModel( IProfilerSession profilerSession, IApplicationEventBus eventBus, IDispatcher dispatcher, IComponentContext componentContext) { if (profilerSession == null) { throw new ArgumentNullException("profilerSession"); } if (eventBus == null) { throw new ArgumentNullException("eventBus"); } if (componentContext == null) { throw new ArgumentNullException("componentContext"); } _profilerSession = profilerSession; _eventBus = eventBus; _dispatcher = dispatcher; _componentContext = componentContext; NavigateBack = new RelayCommand(GoBack, () => _navigationJournal.CanGoBack); GoToEvents = new RelayCommand(Navigate <EventsView>, () => _isConnected); GoToComponents = new RelayCommand(Navigate <ComponentsView>, () => _isConnected); GoToAnalysis = new RelayCommand(Navigate <AnalysisView>, () => _isConnected); _navigationJournal.PropertyChanged += (s, e) => { if (e.PropertyName == "Current") { NotifyPropertyChanged("CurrentViewContent"); NotifyPropertyChanged("Title"); NotifyPropertyChanged("PreviousTitle"); } }; eventBus.Subscribe(this); Navigate <WaitingView>(); }