public void ViewClose(ViewModelBase viewModel) { if (_openViewModelMapping.ContainsKey(viewModel.GetType())) { IChildView childView = _openViewModelMapping[viewModel.GetType()]; DispatcherSynchronizationContext.Post(_ => childView.Close(), null); _openViewModelMapping.Remove(viewModel.GetType()); } }
public void ViewShow(ViewModelBase viewModel) { if (_openViewModelMapping.ContainsKey(viewModel.GetType())) { ((Window) (_openViewModelMapping[viewModel.GetType()])).Activate(); return; } Type viewModelType = viewModel.GetType(); var childView = ServiceLocator.Current.GetInstance<IChildView>(viewModelType.Name.Replace("ViewModel", "View")); childView.DataContext = viewModel; childView.Show(); _openViewModelMapping.Add(viewModel.GetType(), childView); }
private void InstanceViewModelShowEvent(ViewModelBase viewmodel) { ViewManager.ViewShow(viewmodel); }
private void InstanceViewModelCloseEvent(ViewModelBase viewModel) { ViewManager.ViewClose(viewModel); }