Пример #1
0
        public void AutoStart()
        {
            bool IsAutoStart = (MinerProfile.IsAutoStart || CommandLineArgs.IsAutoStart);

            if (IsAutoStart && !this.MinerProfile.IsMining)
            {
                this.MinerProfile.IsMining = true;
                IMessagePathId handler = null;
                handler = VirtualRoot.BuildViaLimitPath <Per1SecondEvent>("挖矿倒计时", LogEnum.None,
                                                                          action: message => {
                    if (NTMinerRoot.IsAutoStartCanceled)
                    {
                        BtnStopText = $"尚未开始";
                    }
                    else
                    {
                        BtnStopText = $"倒计时{handler.ViaLimit.ToString()}";
                    }
                    if (handler.ViaLimit == 0)
                    {
                        if (!NTMinerRoot.IsAutoStartCanceled)
                        {
                            BtnStopText           = "正在挖矿";
                            MinerProfile.IsMining = true;
                            VirtualRoot.ThisLocalInfo(nameof(StartStopMineButtonViewModel), $"自动开始挖矿", toConsole: true);
                            NTMinerRoot.Instance.StartMine();
                        }
                    }
                }, viaLimit: MinerProfile.AutoStartDelaySeconds);
            }
        }