public KernelOutputKeywordsViewModel() {
     if (WpfUtil.IsInDesignMode) {
         return;
     }
     VirtualRoot.BuildEventPath<CurrentMineContextChangedEvent>("挖矿上下文变更后刷新内核输出关键字Vm视图集", LogEnum.DevConsole,
         path: message => {
             OnPropertyChanged(nameof(KernelOutputVm));
         }, location: this.GetType());
     this.Add = new DelegateCommand(() => {
         KernelOutputViewModel kernelOutputVm = KernelOutputVm;
         if (kernelOutputVm == null) {
             return;
         }
         var data = new KernelOutputKeywordData {
             Id = Guid.NewGuid(),
             MessageType = LocalMessageType.Info.GetName(),
             Keyword = string.Empty,
             Description = string.Empty,
             KernelOutputId = kernelOutputVm.Id
         };
         // 新建的内核输出关键字时的工作流:默认为Profile级,测试没问题后,然后在界面上提供个按钮转化为Global级提交到服务器
         data.SetDataLevel(DataLevel.Profile);
         new KernelOutputKeywordViewModel(data).Edit.Execute(FormType.Add);
     });
 }
示例#2
0
 private void Init()
 {
     VirtualRoot.On <KernelOutputAddedEvent>("添加了内核输出组后刷新VM内存", LogEnum.DevConsole,
                                             action: message => {
         var vm = new KernelOutputViewModel(message.Source);
         _dicById.Add(message.Source.GetId(), vm);
         OnPropertyChanged(nameof(AllKernelOutputVms));
         OnPropertyChanged(nameof(PleaseSelectVms));
     }).AddToCollection(NTMinerRoot.Current.ContextHandlers);
     VirtualRoot.On <KernelOutputUpdatedEvent>("更新了内核输出组后刷新VM内存", LogEnum.DevConsole,
                                               action: message => {
         if (_dicById.ContainsKey(message.Source.GetId()))
         {
             var item = _dicById[message.Source.GetId()];
             if (item != null)
             {
                 item.Update(message.Source);
             }
         }
     }).AddToCollection(NTMinerRoot.Current.ContextHandlers);
     VirtualRoot.On <KernelOutputRemovedEvent>("移除了内核输出组后刷新VM内存", LogEnum.DevConsole,
                                               action: message => {
         if (_dicById.ContainsKey(message.Source.GetId()))
         {
             _dicById.Remove(message.Source.GetId());
             OnPropertyChanged(nameof(AllKernelOutputVms));
             OnPropertyChanged(nameof(PleaseSelectVms));
         }
     }).AddToCollection(NTMinerRoot.Current.ContextHandlers);
     foreach (var item in NTMinerRoot.Current.KernelOutputSet)
     {
         _dicById.Add(item.GetId(), new KernelOutputViewModel(item));
     }
 }
 public KernelOutputKeywordsViewModel()
 {
     if (WpfUtil.IsInDesignMode)
     {
         return;
     }
     VirtualRoot.BuildEventPath <CurrentMineContextChangedEvent>("挖矿上下文变更后刷新内核输出关键字Vm视图集", LogEnum.DevConsole,
                                                                 action: message => {
         OnPropertyChanged(nameof(KernelOutputVm));
     });
     this.Add = new DelegateCommand(() => {
         KernelOutputViewModel kernelOutputVm = KernelOutputVm;
         if (kernelOutputVm == null)
         {
             return;
         }
         new KernelOutputKeywordViewModel(new KernelOutputKeywordData {
             Id             = Guid.NewGuid(),
             MessageType    = LocalMessageType.Info.GetName(),
             DataLevel      = DevMode.IsDevMode? DataLevel.Global: DataLevel.Profile,
             Keyword        = string.Empty,
             Description    = string.Empty,
             KernelOutputId = kernelOutputVm.Id
         }).Edit.Execute(FormType.Add);
     });
 }
示例#4
0
 private KernelOutputViewModels()
 {
     Global.Access <KernelOutputAddedEvent>(
         Guid.Parse("E1864E02-ED87-49D6-AD9F-A54953D6BC7E"),
         "添加了内核输出组后刷新VM内存",
         LogEnum.None,
         action: message => {
         var vm = new KernelOutputViewModel(message.Source);
         _dicById.Add(message.Source.GetId(), vm);
         OnPropertyChanged(nameof(AllKernelOutputVms));
         OnPropertyChanged(nameof(PleaseSelectVms));
     });
     Global.Access <KernelOutputUpdatedEvent>(
         Guid.Parse("AA98F304-B7E1-4E93-8AFB-55F72EA37689"),
         "更新了内核输出组后刷新VM内存",
         LogEnum.None,
         action: message => {
         if (_dicById.ContainsKey(message.Source.GetId()))
         {
             var item = _dicById[message.Source.GetId()];
             if (item != null)
             {
                 item.Update(message.Source);
             }
         }
     });
     Global.Access <KernelOutputRemovedEvent>(
         Guid.Parse("BE4A8820-AA3E-474B-AF04-9798D4B08DFC"),
         "移除了内核输出组后刷新VM内存",
         LogEnum.None,
         action: message => {
         if (_dicById.ContainsKey(message.Source.GetId()))
         {
             _dicById.Remove(message.Source.GetId());
             OnPropertyChanged(nameof(AllKernelOutputVms));
             OnPropertyChanged(nameof(PleaseSelectVms));
         }
     });
     foreach (var item in NTMinerRoot.Current.KernelOutputSet)
     {
         _dicById.Add(item.GetId(), new KernelOutputViewModel(item));
     }
 }
 public KernelOutputKeywordsViewModel()
 {
     if (WpfUtil.IsInDesignMode)
     {
         return;
     }
     VirtualRoot.BuildEventPath <CurrentMineContextChangedEvent>("挖矿上下文变更后刷新内核输出关键字Vm视图集", LogEnum.DevConsole, location: this.GetType(), PathPriority.Normal,
                                                                 path: message => {
         OnPropertyChanged(nameof(KernelOutputVm));
     });
     this.Add = new DelegateCommand(() => {
         KernelOutputViewModel kernelOutputVm = KernelOutputVm;
         if (kernelOutputVm == null)
         {
             return;
         }
         // 新建的内核输出关键字时的工作流:默认为Profile级,测试没问题后,然后在界面上提供个按钮转化为Global级提交到服务器
         new KernelOutputKeywordViewModel(Guid.NewGuid(), kernelOutputVm.Id, nameof(LocalMessageType.Info), DataLevel.Profile).Edit.Execute(FormType.Add);
     });
 }
示例#6
0
 public bool TryGetKernelOutputVm(Guid id, out KernelOutputViewModel kernelOutputVm)
 {
     return(_dicById.TryGetValue(id, out kernelOutputVm));
 }
示例#7
0
 public KernelOutputSelectViewModel(KernelOutputViewModel selected, Action <KernelOutputViewModel> onOk)
 {
     _selectedResult = selected;
     OnOk            = onOk;
 }