Ejemplo n.º 1
0
        public void RegisterChildViewModel(ControlViewModelBase controlViewModelBase, ViewModelProviderAction viewModelProviderAction)
        {
            if (controlViewModelBase != null)
              {
            ChildrenViewModels.Add(controlViewModelBase, viewModelProviderAction);

            if (((viewModelProviderAction & ViewModelProviderAction.IsReadOnlyChanged) == ViewModelProviderAction.IsReadOnlyChanged) ||
              ((viewModelProviderAction & ViewModelProviderAction.EditingModeChanged) == ViewModelProviderAction.EditingModeChanged))
            {
              controlViewModelBase.PropertyChanged +=
            new System.ComponentModel.PropertyChangedEventHandler(controlViewModelBase_PropertyChanged);
            }

            if ((viewModelProviderAction & ViewModelProviderAction.RefreshInvoked) == ViewModelProviderAction.RefreshInvoked)
            {
              controlViewModelBase.Refreshed += new EventHandler(controlViewModelBase_Refreshed);
            }

            if (controlViewModelBase is IEditableControlViewModel && ((viewModelProviderAction & ViewModelProviderAction.SaveInvoked) == ViewModelProviderAction.SaveInvoked))
            {
              ((IEditableControlViewModel)controlViewModelBase).ItemSaved += new EventHandler(ViewModelProvider_ItemSaved);
            }

            if (controlViewModelBase is IListingEditableControlViewModel && ((viewModelProviderAction & ViewModelProviderAction.DeleteInvoked) == ViewModelProviderAction.DeleteInvoked))
            {
              ((IListingEditableControlViewModel)controlViewModelBase).ItemDeletedFlagChanged += new EventHandler(ViewModelProvider_ItemDeleted);
            }
              }
        }
Ejemplo n.º 2
0
 public void RegisterChildViewModel(ControlViewModelBase controlViewModelBase)
 {
     RegisterChildViewModel(controlViewModelBase, ViewModelProviderAction.IsReadOnlyChanged | ViewModelProviderAction.EditingModeChanged | ViewModelProviderAction.RefreshInvoked);
 }
Ejemplo n.º 3
0
 public ViewModelProvider(ControlViewModelBase parentViewModel)
 {
     ParentViewModel = parentViewModel;
       ChildrenViewModels = new Dictionary<ControlViewModelBase, ViewModelProviderAction>();
 }
Ejemplo n.º 4
0
 public ViewModelProviderActionEventArgs(ControlViewModelBase viewModel)
 {
     ViewModel = viewModel;
 }
Ejemplo n.º 5
0
 private void OnChildrenViewModelSaveInvoked(ControlViewModelBase viewModel)
 {
     if (ChildrenViewModelSaveInvoked != null && viewModel != null)
       {
     ChildrenViewModelSaveInvoked(this, new ViewModelProviderActionEventArgs(viewModel));
       }
 }
Ejemplo n.º 6
0
 private void OnChildrenViewModelIsReadOnlyChanged(ControlViewModelBase viewModel)
 {
     if (ChildrenViewModelIsReadOnlyChanged != null && viewModel != null)
       {
     ChildrenViewModelIsReadOnlyChanged(this, new ViewModelProviderActionEventArgs(viewModel));
       }
 }