示例#1
0
        public void ViewClose(ViewModelBase viewModel)
        {
            if (_openViewModelMapping.ContainsKey(viewModel.GetType()))
            {
                IChildView childView = _openViewModelMapping[viewModel.GetType()];
                DispatcherSynchronizationContext.Post(_ => childView.Close(), null);

                _openViewModelMapping.Remove(viewModel.GetType());
            }
        }
示例#2
0
        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);
        }
示例#3
0
 private void InstanceViewModelShowEvent(ViewModelBase viewmodel)
 {
     ViewManager.ViewShow(viewmodel);
 }
示例#4
0
 private void InstanceViewModelCloseEvent(ViewModelBase viewModel)
 {
     ViewManager.ViewClose(viewModel);
 }