コード例 #1
0
 public StateChangeGraphViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, wf.StateChangeDefinition change)
     : base(appCtx, dataCtx, parent)
 {
     StateChange = change;
     StateChange.PropertyChanged += (s, e) =>
     {
         switch (e.PropertyName)
         {
         case "Name":
             OnPropertyChanged("Name");
             break;
         }
     };
 }
コード例 #2
0
 private StateChangeGraphViewModel ToStateChangeViewModel(wf.StateChangeDefinition change)
 {
     if (!_stateChangeViewModels.ContainsKey(change))
     {
         var vm = _stateChangeViewModels[change] = ViewModelFactory.CreateViewModel <StateChangeGraphViewModel.Factory>().Invoke(DataContext, this, change);
         vm.IsSelectedChanged += (s, e) =>
         {
             var sender = (StateChangeGraphViewModel)s;
             if (sender.IsSelected)
             {
                 _stateChangeViewModels.Values.Except(new[] { sender }).ForEach(i => i.IsSelected = false);
                 SelectedStateChange = sender;
             }
             else if (SelectedStateChange == sender)
             {
                 SelectedStateChange = null;
             }
         };
     }
     return(_stateChangeViewModels[change]);
 }