private MainWindowViewModel()
 {
     if (Design.IsInDesignMode)
     {
         return;
     }
     this.StartMine = new DelegateCommand(() => {
         this.StateBarVm.IsMining = true;
         NTMinerRoot.Current.StartMine();
     });
     this.StopMine = new DelegateCommand(() => {
         if (!NTMinerRoot.Current.IsMining)
         {
             this.StateBarVm.IsMining = false;
         }
         NTMinerRoot.Current.StopMineAsync();
     });
     this.UseThisPcName = new DelegateCommand(() => {
         string thisPcName = NTMinerRoot.GetThisPcName();
         DialogWindow.ShowDialog(message: $"确定使用本机名{thisPcName}作为矿机名吗?", title: "确认", onYes: () => {
             MinerProfile.MinerName = thisPcName;
         }, icon: IconConst.IconConfirm);
     });
     if (DevMode.IsDevMode)
     {
         VirtualRoot.On <ServerJsonVersionChangedEvent>("在开发者调试区展示ServerJsonVersion", LogEnum.DevConsole,
                                                        action: message => {
             this.ServerJsonVersion = NTMinerRoot.JsonFileVersion;
         });
         _serverJsonVersion = NTMinerRoot.JsonFileVersion;
     }
 }
Beispiel #2
0
 public MainWindowViewModel()
 {
     if (Design.IsInDesignMode)
     {
         return;
     }
     this.CloseMainWindow = new DelegateCommand(() => {
         if (MinerProfile.IsNoUi)
         {
             VirtualRoot.Execute(new CloseMainWindowCommand());
         }
         else
         {
             VirtualRoot.Execute(new CloseNTMinerCommand());
         }
     });
     this.CustomTheme = new DelegateCommand(() => {
         LogColor.ShowWindow();
     });
     this.UseThisPcName = new DelegateCommand(() => {
         string thisPcName = NTMinerRoot.GetThisPcName();
         DialogWindow.ShowDialog(message: $"确定使用本机名{thisPcName}作为矿机名吗?", title: "确认", onYes: () => {
             MinerProfile.MinerName = thisPcName;
         }, icon: IconConst.IconConfirm);
     });
     if (DevMode.IsDevMode)
     {
         _serverJsonVersion = GetServerJsonVersion();
     }
 }
 public MainWindowViewModel()
 {
     if (Design.IsInDesignMode)
     {
         return;
     }
     RefreshDaemonStateBrush();
     this.CloseMainWindow = new DelegateCommand(() => {
         VirtualRoot.Execute(new CloseMainWindowCommand("已切换为无界面模式运行"));
     });
     this.CustomTheme = new DelegateCommand(() => {
         VirtualRoot.Execute(new ShowLogColorCommand());
     });
     this.UseThisPcName = new DelegateCommand(() => {
         string thisPcName = NTMinerRoot.GetThisPcName();
         this.ShowDialog(message: $"确定使用本机名{thisPcName}作为矿机名吗?", title: "确认", onYes: () => {
             MinerProfile.MinerName = thisPcName;
         }, icon: IconConst.IconConfirm);
     });
     if (DevMode.IsDevMode)
     {
         _serverJsonVersion = GetServerJsonVersion();
     }
 }