Esempio n. 1
0
        public void AutoStart()
        {
            bool isAutoStart = (MinerProfile.IsAutoStart || CommandLineArgs.IsAutoStart);

            if (isAutoStart && !this.MinerProfile.IsMining)
            {
                NTMinerConsole.UserInfo($"{MinerProfile.AutoStartDelaySeconds.ToString()}秒后开始挖矿");
                this.MinerProfile.IsMining = true;
                IMessagePathId pathId = null;
                pathId = VirtualRoot.AddViaTimesLimitPath <Per1SecondEvent>("挖矿倒计时", LogEnum.None,
                                                                            action: message => {
                    if (NTMinerContext.IsAutoStartCanceled)
                    {
                        BtnStopText = $"尚未开始";
                    }
                    else
                    {
                        BtnStopText = $"倒计时{pathId.ViaTimesLimit.ToString()}";
                    }
                    if (pathId.ViaTimesLimit == 0)
                    {
                        if (!NTMinerContext.IsAutoStartCanceled)
                        {
                            VirtualRoot.ThisLocalInfo(nameof(StartStopMineButtonViewModel), $"自动开始挖矿", toConsole: true);
                            NTMinerContext.Instance.StartMine();
                        }
                    }
                }, location: this.GetType(), viaTimesLimit: MinerProfile.AutoStartDelaySeconds);
            }
        }