示例#1
0
 public void ViewClose(ViewModelBase viewModel)
 {
     if(OpenViewModelMapping.ContainsKey(viewModel))
     {
         IChildView childView = OpenViewModelMapping[viewModel];
         childView.Close();
      
         OpenViewModelMapping.Remove(viewModel);
     }
 }
示例#2
0
        public void ViewShow(ViewModelBase viewModel)
        {
            if (OpenViewModelMapping.ContainsKey(viewModel))
            {
                throw new ArgumentException("View model is open");
            }

            IChildView childView;
            Type viewModelType = viewModel.GetType();

            childView = ServiceLocator.Current.GetInstance<IChildView>
                (viewModelType.Name.Replace("ViewModel", "View"));

            childView.DataContext = viewModel;
            childView.Show();
            OpenViewModelMapping.Add(viewModel, childView);

          

          
        }
 public void ViewModelClose(ViewModelBase viewModel)
 {
     OnViewModelCloseEvent(viewModel);
 }
 private void OnViewModelCloseEvent(ViewModelBase viewmodel)
 {
     ViewModelCloseDelegate handler = ViewModelCloseEvent;
     if (handler != null) handler(viewmodel);
 }
 public void ViewModelShow (ViewModelBase viewModel)
 {
     OnViewModelShowEvent(viewModel);
     viewModel.Closed += (sender, args) => ViewModelClose((ViewModelBase) sender);
 }