Exemplo n.º 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());
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 private void InstanceViewModelShowEvent(ViewModelBase viewmodel)
 {
     ViewManager.ViewShow(viewmodel);
 }
Exemplo n.º 4
0
 private void InstanceViewModelCloseEvent(ViewModelBase viewModel)
 {
     ViewManager.ViewClose(viewModel);
 }