public void Initialize() { var viewModel = new TestCollectionsViewModel { CancelCommand = new DelegateCommand(() => _eventAggregator.GetEvent<ShowTestResultsEvent>().Publish(string.Empty)), }; _container.RegisterInstance(viewModel); var region = _regionManager.Regions[RegionNames.MainContent]; var view = _container.Resolve<TestCollectionsView>(); region.Add(view); _eventAggregator.GetEvent<EditTestCollectionEvent>().Subscribe(arg => { viewModel.TestCollections = new ObservableCollection<TestCollectionViewModel>(LoadTestCollections()); viewModel.SelectedItem = viewModel.TestCollections.FirstOrDefault(); region.Activate(view); }, ThreadOption.UIThread, true); _eventAggregator.GetEvent<SelectedManifestChangedEvent>().Subscribe(arg => { viewModel.TestCollections = new ObservableCollection<TestCollectionViewModel>(LoadTestCollections()); viewModel.SelectedItem = viewModel.TestCollections.FirstOrDefault(); }); }
public TestCollectionsView(TestCollectionsViewModel viewModel) { InitializeComponent(); DataContext = viewModel; }