コード例 #1
0
                private static CoinProfileData GetCoinProfileData(Guid coinId)
                {
                    var repository = NTMinerRoot.CreateLocalRepository <CoinProfileData>();
                    var result     = repository.GetByKey(coinId);

                    return(result);
                }
コード例 #2
0
                private static CoinProfileData GetCoinProfileData(MineWorkData mineWorkData, Guid coinId)
                {
                    bool isUseJson = mineWorkData != null;
                    IRepository <CoinProfileData> repository = NTMinerRoot.CreateLocalRepository <CoinProfileData>(isUseJson);
                    var result = repository.GetByKey(coinId);

                    return(result);
                }
コード例 #3
0
ファイル: MinerProfile.cs プロジェクト: bentiancai629/ntminer
 private void Init(INTMinerRoot root, MineWorkData mineWorkData)
 {
     MineWork  = mineWorkData;
     isUseJson = mineWorkData != null;
     if (isUseJson)
     {
         _data = NTMinerRoot.LocalJson.MinerProfile;
     }
     else
     {
         IRepository <MinerProfileData> repository = NTMinerRoot.CreateLocalRepository <MinerProfileData>(false);
         _data = repository.GetAll().FirstOrDefault();
     }
     if (_data == null)
     {
         Guid  coinId = Guid.Empty;
         ICoin coin   = root.CoinSet.OrderBy(a => a.SortNumber).FirstOrDefault();
         if (coin != null)
         {
             coinId = coin.GetId();
         }
         _data = MinerProfileData.CreateDefaultData(coinId);
     }
     if (_coinProfileSet == null)
     {
         _coinProfileSet = new CoinProfileSet(root, mineWorkData);
     }
     else
     {
         _coinProfileSet.Refresh(mineWorkData);
     }
     if (_coinKernelProfileSet == null)
     {
         _coinKernelProfileSet = new CoinKernelProfileSet(root, mineWorkData);
     }
     else
     {
         _coinKernelProfileSet.Refresh(mineWorkData);
     }
     if (_poolProfileSet == null)
     {
         _poolProfileSet = new PoolProfileSet(root, mineWorkData);
     }
     else
     {
         _poolProfileSet.Refresh(mineWorkData);
     }
     if (_walletSet == null)
     {
         _walletSet = new WalletSet(root);
     }
     else
     {
         _walletSet.Refresh();
     }
 }
コード例 #4
0
                private static CoinKernelProfileData GetCoinKernelProfileData(Guid coinKernelId)
                {
                    IRepository <CoinKernelProfileData> repository = NTMinerRoot.CreateLocalRepository <CoinKernelProfileData>();
                    var result = repository.GetByKey(coinKernelId);

                    if (result == null)
                    {
                        result = CoinKernelProfileData.CreateDefaultData(coinKernelId);
                    }
                    return(result);
                }
コード例 #5
0
ファイル: WalletSet.cs プロジェクト: TimeYM/ntminer
 private void RemoveWallet(Guid id)
 {
     if (UseRemoteWalletList)
     {
         Server.ControlCenterService.RemoveWallet(id, null);
     }
     else
     {
         var repository = NTMinerRoot.CreateLocalRepository <WalletData>();
         repository.Remove(id);
     }
 }
コード例 #6
0
                private static CoinKernelProfileData GetCoinKernelProfileData(MineWorkData mineWorkData, Guid coinKernelId)
                {
                    bool isUseJson = mineWorkData != null;
                    IRepository <CoinKernelProfileData> repository = NTMinerRoot.CreateLocalRepository <CoinKernelProfileData>(isUseJson);
                    var result = repository.GetByKey(coinKernelId);

                    if (result == null)
                    {
                        result = CoinKernelProfileData.CreateDefaultData(coinKernelId);
                    }
                    return(result);
                }
コード例 #7
0
ファイル: WalletSet.cs プロジェクト: UcAspNet/ntminer
 private void RemoveWallet(Guid id)
 {
     if (VirtualRoot.IsMinerStudio)
     {
         RpcRoot.Server.WalletService.RemoveWalletAsync(id, null);
     }
     else
     {
         var repository = NTMinerRoot.CreateLocalRepository <WalletData>();
         repository.Remove(id);
     }
 }
コード例 #8
0
 private void RemoveWallet(Guid id)
 {
     if (VirtualRoot.IsMinerStudio)
     {
         Server.ControlCenterService.RemoveWalletAsync(id, null);
     }
     else
     {
         var repository = NTMinerRoot.CreateLocalRepository <WalletData>(isUseJson: false);
         repository.Remove(id);
     }
 }
コード例 #9
0
ファイル: WalletSet.cs プロジェクト: UcAspNet/ntminer
 private void UpdateWallet(WalletData entity)
 {
     if (VirtualRoot.IsMinerStudio)
     {
         RpcRoot.Server.WalletService.AddOrUpdateWalletAsync(entity, null);
     }
     else
     {
         var repository = NTMinerRoot.CreateLocalRepository <WalletData>();
         repository.Update(entity);
     }
 }
コード例 #10
0
ファイル: WalletSet.cs プロジェクト: TimeYM/ntminer
 private void UpdateWallet(WalletData entity)
 {
     if (UseRemoteWalletList)
     {
         Server.ControlCenterService.AddOrUpdateWallet(entity, null);
     }
     else
     {
         var repository = NTMinerRoot.CreateLocalRepository <WalletData>();
         repository.Update(entity);
     }
 }
コード例 #11
0
 private void AddWallet(WalletData entity)
 {
     if (VirtualRoot.IsMinerStudio)
     {
         Server.ControlCenterService.AddOrUpdateWalletAsync(entity, null);
     }
     else
     {
         var repository = NTMinerRoot.CreateLocalRepository <WalletData>();
         repository.Add(entity);
     }
 }
コード例 #12
0
        private void Init(INTMinerRoot root)
        {
            IRepository <MinerProfileData> minerProfileRepository = NTMinerRoot.CreateLocalRepository <MinerProfileData>();

            _data = minerProfileRepository.GetAll().FirstOrDefault();
            IRepository <MineWorkData> mineWorkRepository = NTMinerRoot.CreateLocalRepository <MineWorkData>();

            MineWork = mineWorkRepository.GetAll().FirstOrDefault();
            if (_data == null)
            {
                Guid  coinId = Guid.Empty;
                ICoin coin   = root.CoinSet.OrderBy(a => a.Code).FirstOrDefault();
                if (coin != null)
                {
                    coinId = coin.GetId();
                }
                _data = MinerProfileData.CreateDefaultData(coinId);
            }
            if (_coinProfileSet == null)
            {
                _coinProfileSet = new CoinProfileSet(root);
            }
            else
            {
                _coinProfileSet.Refresh();
            }
            if (_coinKernelProfileSet == null)
            {
                _coinKernelProfileSet = new CoinKernelProfileSet(root);
            }
            else
            {
                _coinKernelProfileSet.Refresh();
            }
            if (_poolProfileSet == null)
            {
                _poolProfileSet = new PoolProfileSet(root);
            }
            else
            {
                _poolProfileSet.Refresh();
            }
            if (_walletSet == null)
            {
                _walletSet = new WalletSet(root);
            }
            else
            {
                _walletSet.Refresh();
            }
        }
コード例 #13
0
                private static PoolProfileData GetPoolProfileData(INTMinerRoot root, Guid poolId)
                {
                    IRepository <PoolProfileData> repository = NTMinerRoot.CreateLocalRepository <PoolProfileData>();
                    var result = repository.GetByKey(poolId);

                    if (result == null)
                    {
                        if (root.PoolSet.TryGetPool(poolId, out IPool pool))
                        {
                            // 如果本地未设置用户名密码则使用默认的测试用户名密码
                            result = PoolProfileData.CreateDefaultData(pool);
                        }
                    }
                    return(result);
                }
コード例 #14
0
ファイル: WalletSet.cs プロジェクト: bxlkm1/NtMiner
 private void RemoveWallet(Guid id)
 {
     if (VirtualRoot.IsMinerStudio)
     {
         RpcRoot.Server.WalletService.RemoveWalletAsync(id, (response, e) => {
             if (!response.IsSuccess())
             {
                 VirtualRoot.Out.ShowError(response.ReadMessage(e), autoHideSeconds: 4);
             }
         });
     }
     else
     {
         var repository = NTMinerRoot.CreateLocalRepository <WalletData>();
         repository.Remove(id);
     }
 }
コード例 #15
0
ファイル: CoinProfileSet.cs プロジェクト: TimeYM/ntminer
 private CoinProfileData GetCoinProfileData(Guid coinId)
 {
     if (CommandLineArgs.IsWorker)
     {
         return(Server.ProfileService.GetCoinProfile(CommandLineArgs.WorkId, coinId));
     }
     else
     {
         IRepository <CoinProfileData> repository = NTMinerRoot.CreateLocalRepository <CoinProfileData>();
         var result = repository.GetByKey(coinId);
         if (result == null)
         {
             result = CoinProfileData.CreateDefaultData(coinId);
         }
         return(result);
     }
 }
コード例 #16
0
ファイル: WalletSet.cs プロジェクト: bxlkm1/NtMiner
 private void UpdateWallet(WalletData entity)
 {
     if (VirtualRoot.IsMinerStudio)
     {
         RpcRoot.Server.WalletService.AddOrUpdateWalletAsync(entity, (response, e) => {
             if (!response.IsSuccess())
             {
                 VirtualRoot.Out.ShowError(response.ReadMessage(e), autoHideSeconds: 4);
             }
         });
     }
     else
     {
         var repository = NTMinerRoot.CreateLocalRepository <WalletData>();
         repository.Update(entity);
     }
 }
コード例 #17
0
 private MinerProfileData GetMinerProfileData()
 {
     if (CommandLineArgs.IsWorker)
     {
         return(Server.ProfileService.GetMinerProfile(CommandLineArgs.WorkId));
     }
     else
     {
         IRepository <MinerProfileData> repository = NTMinerRoot.CreateLocalRepository <MinerProfileData>();
         var result = repository.GetAll().FirstOrDefault();
         if (result == null)
         {
             result = MinerProfileData.CreateDefaultData();
         }
         return(result);
     }
 }
コード例 #18
0
 private void Init()
 {
     if (!_isInited)
     {
         if (VirtualRoot.IsMinerStudio)
         {
             lock (_locker) {
                 if (!_isInited)
                 {
                     var response = Server.ControlCenterService.GetWallets();
                     if (response != null)
                     {
                         foreach (var item in response.Data)
                         {
                             if (!_dicById.ContainsKey(item.Id))
                             {
                                 _dicById.Add(item.Id, item);
                             }
                         }
                     }
                     _isInited = true;
                 }
             }
         }
         else
         {
             bool isUseJson  = _mineWorkData != null;
             var  repository = NTMinerRoot.CreateLocalRepository <WalletData>(isUseJson: isUseJson);
             lock (_locker) {
                 if (!_isInited)
                 {
                     foreach (var item in repository.GetAll())
                     {
                         if (!_dicById.ContainsKey(item.Id))
                         {
                             _dicById.Add(item.Id, item);
                         }
                     }
                     _isInited = true;
                 }
             }
         }
     }
 }
コード例 #19
0
ファイル: WalletSet.cs プロジェクト: UcAspNet/ntminer
 private void Init()
 {
     if (!_isInited)
     {
         if (VirtualRoot.IsMinerStudio)
         {
             lock (_locker) {
                 if (!_isInited)
                 {
                     var response = RpcRoot.Server.WalletService.GetWallets();
                     if (response != null)
                     {
                         foreach (var item in response.Data)
                         {
                             if (!_dicById.ContainsKey(item.Id))
                             {
                                 _dicById.Add(item.Id, item);
                             }
                         }
                     }
                     _isInited = true;
                 }
             }
         }
         else
         {
             var repository = NTMinerRoot.CreateLocalRepository <WalletData>();
             lock (_locker) {
                 if (!_isInited)
                 {
                     foreach (var item in repository.GetAll())
                     {
                         if (!_dicById.ContainsKey(item.Id))
                         {
                             _dicById.Add(item.Id, item);
                         }
                     }
                     _isInited = true;
                 }
             }
         }
     }
 }
コード例 #20
0
ファイル: WalletSet.cs プロジェクト: TimeYM/ntminer
 private void Init()
 {
     if (!_isInited)
     {
         if (UseRemoteWalletList)
         {
             lock (_locker) {
                 if (!_isInited)
                 {
                     var response = Server.ControlCenterService.GetWallets();
                     if (response != null)
                     {
                         foreach (var item in response.Data)
                         {
                             if (!_dicById.ContainsKey(item.Id))
                             {
                                 _dicById.Add(item.Id, item);
                             }
                         }
                     }
                     _isInited = true;
                 }
             }
         }
         else
         {
             var repository = NTMinerRoot.CreateLocalRepository <WalletData>();
             lock (_locker) {
                 if (!_isInited)
                 {
                     foreach (var item in repository.GetAll())
                     {
                         if (!_dicById.ContainsKey(item.Id))
                         {
                             _dicById.Add(item.Id, item);
                         }
                     }
                     _isInited = true;
                 }
             }
         }
     }
 }
コード例 #21
0
 private PoolProfileData GetPoolProfileData(Guid poolId)
 {
     if (CommandLineArgs.IsWorker)
     {
         return(Server.ProfileService.GetPoolProfile(CommandLineArgs.WorkId, poolId));
     }
     else
     {
         IRepository <PoolProfileData> repository = NTMinerRoot.CreateLocalRepository <PoolProfileData>();
         var result = repository.GetByKey(poolId);
         if (result == null)
         {
             string userName = string.Empty;
             string password = string.Empty;
             if (_root.PoolSet.TryGetPool(poolId, out IPool pool))
             {
                 userName = pool.UserName;
                 password = pool.Password;
             }
             result = PoolProfileData.CreateDefaultData(poolId);
         }
         return(result);
     }
 }
コード例 #22
0
        public MinerProfileViewModel()
        {
#if DEBUG
            NTStopwatch.Start();
#endif
            if (WpfUtil.IsInDesignMode)
            {
                return;
            }
            if (Instance != null)
            {
                throw new InvalidProgramException();
            }
            if (this.IsCreateShortcut)
            {
                CreateShortcut();
            }
            this.Up = new DelegateCommand <string>(propertyName => {
                PropertyInfo propertyInfo = this.GetType().GetProperty(propertyName);
                if (propertyInfo != null)
                {
                    if (propertyInfo.PropertyType == typeof(int))
                    {
                        propertyInfo.SetValue(this, (int)propertyInfo.GetValue(this, null) + 1, null);
                    }
                    else if (propertyInfo.PropertyType == typeof(double))
                    {
                        propertyInfo.SetValue(this, Math.Round((double)propertyInfo.GetValue(this, null) + 0.1, 2), null);
                    }
                }
                else
                {
                    Write.DevError($"类型{this.GetType().FullName}不具有名称为{propertyName}的属性");
                }
            });
            this.Down = new DelegateCommand <string>(propertyName => {
                PropertyInfo propertyInfo = this.GetType().GetProperty(propertyName);
                if (propertyInfo != null)
                {
                    if (propertyInfo.PropertyType == typeof(int))
                    {
                        int value = (int)propertyInfo.GetValue(this, null);
                        if (value > 0)
                        {
                            propertyInfo.SetValue(this, value - 1, null);
                        }
                    }
                    else if (propertyInfo.PropertyType == typeof(double))
                    {
                        double value = (double)propertyInfo.GetValue(this, null);
                        if (value > 0.1)
                        {
                            propertyInfo.SetValue(this, Math.Round(value - 0.1, 2), null);
                        }
                    }
                }
                else
                {
                    Write.DevError($"类型{this.GetType().FullName}不具有名称为{propertyName}的属性");
                }
            });
            NTMinerRoot.SetRefreshArgsAssembly(() => {
#if DEBUG
                NTStopwatch.Start();
#endif
                if (CoinVm != null && CoinVm.CoinKernel != null && CoinVm.CoinKernel.Kernel != null)
                {
                    var coinKernelProfile = CoinVm.CoinKernel.CoinKernelProfile;
                    var kernelInput       = CoinVm.CoinKernel.Kernel.KernelInputVm;
                    if (coinKernelProfile != null && kernelInput != null)
                    {
                        if (coinKernelProfile.IsDualCoinEnabled && !kernelInput.IsAutoDualWeight)
                        {
                            if (coinKernelProfile.DualCoinWeight > kernelInput.DualWeightMax)
                            {
                                coinKernelProfile.DualCoinWeight = kernelInput.DualWeightMax;
                            }
                            else if (coinKernelProfile.DualCoinWeight < kernelInput.DualWeightMin)
                            {
                                coinKernelProfile.DualCoinWeight = kernelInput.DualWeightMin;
                            }
                            NTMinerRoot.Instance.MinerProfile.SetCoinKernelProfileProperty(coinKernelProfile.CoinKernelId, nameof(coinKernelProfile.DualCoinWeight), coinKernelProfile.DualCoinWeight);
                        }
                    }
                }
                NTMinerRoot.Instance.CurrentMineContext = NTMinerRoot.Instance.CreateMineContext();
                if (NTMinerRoot.Instance.CurrentMineContext != null)
                {
                    this.ArgsAssembly = NTMinerRoot.Instance.CurrentMineContext.CommandLine;
                }
                else
                {
                    this.ArgsAssembly = string.Empty;
                }
#if DEBUG
                var milliseconds = NTStopwatch.Stop();
                if (milliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds)
                {
                    Write.DevTimeSpan($"耗时{milliseconds} {this.GetType().Name}.SetRefreshArgsAssembly");
                }
#endif
            });
            VirtualRoot.AddEventPath <ServerContextVmsReInitedEvent>("ServerContext的VM集刷新后刷新视图界面", LogEnum.DevConsole,
                                                                     action: message => {
                OnPropertyChanged(nameof(CoinVm));
            }, location: this.GetType());
            AppContext.AddCmdPath <RefreshAutoBootStartCommand>("刷新开机启动和自动挖矿的展示", LogEnum.DevConsole,
                                                                action: message => {
                MinerProfileData data = NTMinerRoot.CreateLocalRepository <MinerProfileData>().GetByKey(this.Id);
                if (data != null)
                {
                    this.IsAutoBoot  = data.IsAutoBoot;
                    this.IsAutoStart = data.IsAutoStart;
                }
            }, location: this.GetType());
            AppContext.AddEventPath <MinerProfilePropertyChangedEvent>("MinerProfile设置变更后刷新VM内存", LogEnum.DevConsole,
                                                                       action: message => {
                OnPropertyChanged(message.PropertyName);
            }, location: this.GetType());

            VirtualRoot.AddEventPath <LocalContextVmsReInitedEvent>("本地上下文视图模型集刷新后刷新界面", LogEnum.DevConsole,
                                                                    action: message => {
                AllPropertyChanged();
                if (CoinVm != null)
                {
                    CoinVm.OnPropertyChanged(nameof(CoinVm.Wallets));
                    CoinVm.CoinKernel?.CoinKernelProfile.SelectedDualCoin?.OnPropertyChanged(nameof(CoinVm.Wallets));
                    CoinVm.CoinProfile.OnPropertyChanged(nameof(CoinVm.CoinProfile.SelectedWallet));
                    CoinVm.CoinKernel?.CoinKernelProfile.SelectedDualCoin?.CoinProfile.OnPropertyChanged(nameof(CoinVm.CoinProfile.SelectedDualCoinWallet));
                }
            }, location: this.GetType());
#if DEBUG
            var elapsedMilliseconds = NTStopwatch.Stop();
            if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds)
            {
                Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor");
            }
#endif
        }
コード例 #23
0
ファイル: PoolSet.cs プロジェクト: snowdream1985/ntminer
 /// <summary>
 /// 创建组合仓储,组合仓储由ServerDb和ProfileDb层序组成。
 /// 如果是开发者则访问ServerDb且只访问GlobalDb,否则将ServerDb和ProfileDb并起来访问且不能修改删除GlobalDb。
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 private static IRepository <T> CreateCompositeRepository <T>(bool isUseJson) where T : class, ILevelEntity <Guid>
 {
     return(new CompositeRepository <T>(NTMinerRoot.CreateServerRepository <T>(isUseJson), NTMinerRoot.CreateLocalRepository <T>(isUseJson: false)));
 }
コード例 #24
0
                public static CoinKernelProfile Create(INTMinerRoot root, Guid coinKernelId)
                {
                    if (root.ServerContext.CoinKernelSet.TryGetCoinKernel(coinKernelId, out ICoinKernel coinKernel))
                    {
                        var repository             = NTMinerRoot.CreateLocalRepository <CoinKernelProfileData>();
                        CoinKernelProfileData data = repository.GetByKey(coinKernelId);
                        if (data == null)
                        {
                            double dualCoinWeight = GetDualCoinWeight(root, coinKernel.KernelId);
                            data = CoinKernelProfileData.CreateDefaultData(coinKernel.GetId(), dualCoinWeight);
                        }
                        if (root.ServerContext.GroupSet.TryGetGroup(coinKernel.DualCoinGroupId, out IGroup group))
                        {
                            var coinIds = root.ServerContext.CoinGroupSet.GetGroupCoinIds(coinKernel.DualCoinGroupId);
                            if (!coinIds.Contains(data.DualCoinId))
                            {
                                data.DualCoinId = coinIds.FirstOrDefault();
                            }
                        }
                        CoinKernelProfile coinProfile = new CoinKernelProfile(data);

                        var    defaultInputSegments = coinKernel.InputSegments.Where(a => a.IsDefault && a.TargetGpu.IsSupportedGpu(NTMinerRoot.Instance.GpuSet.GpuType)).ToArray();
                        string touchedArgs          = coinProfile.TouchedArgs;
                        if (coinProfile.CustomArgs == null)
                        {
                            coinProfile.CustomArgs = string.Empty;
                        }
                        if (string.IsNullOrEmpty(touchedArgs))
                        {
                            foreach (var defaultInputSegment in defaultInputSegments)
                            {
                                if (!coinProfile.CustomArgs.Contains(defaultInputSegment.Segment))
                                {
                                    if (coinProfile.CustomArgs.Length == 0)
                                    {
                                        coinProfile.CustomArgs += defaultInputSegment.Segment;
                                    }
                                    else
                                    {
                                        coinProfile.CustomArgs += " " + defaultInputSegment.Segment;
                                    }
                                }
                            }
                        }
                        else
                        {
                            foreach (var defaultInputSegment in defaultInputSegments)
                            {
                                if (!touchedArgs.Contains(defaultInputSegment.Segment) && !coinProfile.CustomArgs.Contains(defaultInputSegment.Segment))
                                {
                                    if (coinProfile.CustomArgs.Length == 0)
                                    {
                                        coinProfile.CustomArgs += defaultInputSegment.Segment;
                                    }
                                    else
                                    {
                                        coinProfile.CustomArgs += " " + defaultInputSegment.Segment;
                                    }
                                }
                            }
                        }
                        return(coinProfile);
                    }
                    else
                    {
                        return(Empty);
                    }
                }
コード例 #25
0
        public MinerProfileViewModel()
        {
#if DEBUG
            Write.Stopwatch.Restart();
#endif
            if (WpfUtil.IsInDesignMode)
            {
                return;
            }
            if (Instance != null)
            {
                throw new InvalidProgramException();
            }
            if (this.IsCreateShortcut)
            {
                CreateShortcut();
            }
            this.AutoStartDelaySecondsUp = new DelegateCommand(() => {
                this.AutoStartDelaySeconds++;
            });
            this.AutoStartDelaySecondsDown = new DelegateCommand(() => {
                if (this.AutoStartDelaySeconds > 0)
                {
                    this.AutoStartDelaySeconds--;
                }
            });
            this.AutoRestartKernelTimesUp = new DelegateCommand(() => {
                this.AutoRestartKernelTimes++;
            });
            this.AutoRestartKernelTimesDown = new DelegateCommand(() => {
                if (this.AutoRestartKernelTimes > 0)
                {
                    this.AutoRestartKernelTimes--;
                }
            });
            this.NoShareRestartKernelMinutesUp = new DelegateCommand(() => {
                this.NoShareRestartKernelMinutes++;
            });
            this.NoShareRestartKernelMinutesDown = new DelegateCommand(() => {
                if (this.NoShareRestartKernelMinutes > 0)
                {
                    this.NoShareRestartKernelMinutes--;
                }
            });
            this.NoShareRestartComputerMinutesUp = new DelegateCommand(() => {
                this.NoShareRestartComputerMinutes++;
            });
            this.NoShareRestartComputerMinutesDown = new DelegateCommand(() => {
                if (this.NoShareRestartComputerMinutes > 0)
                {
                    this.NoShareRestartComputerMinutes--;
                }
            });
            this.PeriodicRestartKernelHoursUp = new DelegateCommand(() => {
                this.PeriodicRestartKernelHours++;
            });
            this.PeriodicRestartKernelHoursDown = new DelegateCommand(() => {
                if (this.PeriodicRestartKernelHours > 0)
                {
                    this.PeriodicRestartKernelHours--;
                }
            });
            this.PeriodicRestartKernelMinutesUp = new DelegateCommand(() => {
                this.PeriodicRestartKernelMinutes++;
            });
            this.PeriodicRestartKernelMinutesDown = new DelegateCommand(() => {
                if (this.PeriodicRestartKernelMinutes > 0)
                {
                    this.PeriodicRestartKernelMinutes--;
                }
            });
            this.PeriodicRestartComputerHoursUp = new DelegateCommand(() => {
                this.PeriodicRestartComputerHours++;
            });
            this.PeriodicRestartComputerHoursDown = new DelegateCommand(() => {
                if (this.PeriodicRestartComputerHours > 0)
                {
                    this.PeriodicRestartComputerHours--;
                }
            });
            this.PeriodicRestartComputerMinutesUp = new DelegateCommand(() => {
                this.PeriodicRestartComputerMinutes++;
            });
            this.PeriodicRestartComputerMinutesDown = new DelegateCommand(() => {
                if (this.PeriodicRestartComputerMinutes > 0)
                {
                    this.PeriodicRestartComputerMinutes--;
                }
            });
            this.CpuGETemperatureSecondsUp = new DelegateCommand(() => {
                this.CpuGETemperatureSeconds++;
            });
            this.CpuGETemperatureSecondsDown = new DelegateCommand(() => {
                this.CpuGETemperatureSeconds--;
            });
            this.CpuStopTemperatureUp = new DelegateCommand(() => {
                this.CpuStopTemperature++;
            });
            this.CpuStopTemperatureDown = new DelegateCommand(() => {
                this.CpuStopTemperature--;
            });
            this.CpuLETemperatureSecondsUp = new DelegateCommand(() => {
                this.CpuLETemperatureSeconds++;
            });
            this.CpuLETemperatureSecondsDown = new DelegateCommand(() => {
                this.CpuLETemperatureSeconds--;
            });
            this.CpuStartTemperatureUp = new DelegateCommand(() => {
                this.CpuStartTemperature++;
            });
            this.CpuStartTemperatureDown = new DelegateCommand(() => {
                this.CpuStartTemperature--;
            });
            this.EPriceUp = new DelegateCommand(() => {
                this.EPrice = Math.Round(this.EPrice + 0.1, 2);
            });
            this.EPriceDown = new DelegateCommand(() => {
                if (this.EPrice > 0.1)
                {
                    this.EPrice = Math.Round(this.EPrice - 0.1, 2);
                }
            });
            this.PowerAppendUp = new DelegateCommand(() => {
                this.PowerAppend++;
            });
            this.PowerAppendDown = new DelegateCommand(() => {
                if (this.PowerAppend > 0)
                {
                    this.PowerAppend--;
                }
            });
            this.MaxTempUp = new DelegateCommand(() => {
                this.MaxTemp++;
            });
            this.MaxTempDown = new DelegateCommand(() => {
                if (this.MaxTemp > 0)
                {
                    this.MaxTemp--;
                }
            });
            this.AutoNoUiMinutesUp = new DelegateCommand(() => {
                this.AutoNoUiMinutes++;
            });
            this.AutoNoUiMinutesDown = new DelegateCommand(() => {
                if (this.AutoNoUiMinutes > 0)
                {
                    this.AutoNoUiMinutes--;
                }
            });
            NTMinerRoot.SetRefreshArgsAssembly(() => {
                if (CoinVm != null && CoinVm.CoinKernel != null && CoinVm.CoinKernel.Kernel != null)
                {
                    var coinKernelProfile = CoinVm.CoinKernel.CoinKernelProfile;
                    var kernelInput       = CoinVm.CoinKernel.Kernel.KernelInputVm;
                    if (coinKernelProfile != null && kernelInput != null)
                    {
                        if (coinKernelProfile.IsDualCoinEnabled && !kernelInput.IsAutoDualWeight)
                        {
                            if (coinKernelProfile.DualCoinWeight > kernelInput.DualWeightMax)
                            {
                                coinKernelProfile.DualCoinWeight = kernelInput.DualWeightMax;
                            }
                            else if (coinKernelProfile.DualCoinWeight < kernelInput.DualWeightMin)
                            {
                                coinKernelProfile.DualCoinWeight = kernelInput.DualWeightMin;
                            }
                            NTMinerRoot.Instance.MinerProfile.SetCoinKernelProfileProperty(coinKernelProfile.CoinKernelId, nameof(coinKernelProfile.DualCoinWeight), coinKernelProfile.DualCoinWeight);
                        }
                    }
                }
                this.ArgsAssembly = NTMinerRoot.Instance.BuildAssembleArgs(out _, out _, out _);
            });
            VirtualRoot.BuildEventPath <ServerContextVmsReInitedEvent>("ServerContext的VM集刷新后刷新视图界面", LogEnum.DevConsole,
                                                                       action: message => {
                OnPropertyChanged(nameof(CoinVm));
            });
            AppContext.AppContextCmdPath <RefreshAutoBootStartCommand>("刷新开机启动和自动挖矿的展示", LogEnum.DevConsole,
                                                                       action: message => {
                MinerProfileData data = NTMinerRoot.CreateLocalRepository <MinerProfileData>().GetByKey(this.Id);
                if (data != null)
                {
                    this.IsAutoBoot  = data.IsAutoBoot;
                    this.IsAutoStart = data.IsAutoStart;
                }
            });
            AppContext.AppContextEventPath <MinerProfilePropertyChangedEvent>("MinerProfile设置变更后刷新VM内存", LogEnum.DevConsole,
                                                                              action: message => {
                OnPropertyChanged(message.PropertyName);
            });

            VirtualRoot.BuildEventPath <LocalContextVmsReInitedEvent>("本地上下文视图模型集刷新后刷新界面", LogEnum.DevConsole,
                                                                      action: message => {
                AllPropertyChanged();
                if (CoinVm != null)
                {
                    CoinVm.OnPropertyChanged(nameof(CoinVm.Wallets));
                    CoinVm.CoinKernel?.CoinKernelProfile.SelectedDualCoin?.OnPropertyChanged(nameof(CoinVm.Wallets));
                    CoinVm.CoinProfile.OnPropertyChanged(nameof(CoinVm.CoinProfile.SelectedWallet));
                    CoinVm.CoinKernel?.CoinKernelProfile.SelectedDualCoin?.CoinProfile.OnPropertyChanged(nameof(CoinVm.CoinProfile.SelectedDualCoinWallet));
                }
            });
#if DEBUG
            Write.DevTimeSpan($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
#endif
        }