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

            if (IsAutoStart && !this.MinerProfile.IsMining)
            {
                this.MinerProfile.IsMining = true;
                int            n       = MinerProfile.AutoStartDelaySeconds;
                IMessagePathId handler = null;
                handler = VirtualRoot.BuildEventPath <Per1SecondEvent>("挖矿倒计时", LogEnum.None,
                                                                       action: message => {
                    if (NTMinerRoot.IsAutoStartCanceled)
                    {
                        BtnStopText = $"尚未开始";
                        n           = 0;
                    }
                    else
                    {
                        BtnStopText = $"倒计时{--n}";
                    }
                    if (n <= 0)
                    {
                        VirtualRoot.DeletePath(handler);
                        if (!NTMinerRoot.IsAutoStartCanceled)
                        {
                            BtnStopText           = "正在挖矿";
                            MinerProfile.IsMining = true;
                            VirtualRoot.ThisLocalInfo(nameof(StartStopMineButtonViewModel), $"自动开始挖矿", toConsole: true);
                            NTMinerRoot.Instance.StartMine();
                        }
                    }
                });
            }
        }
Esempio n. 2
0
 public void ReInit()
 {
     foreach (var handler in _serverContextHandlers)
     {
         VirtualRoot.DeletePath(handler);
     }
     _serverContextHandlers.Clear();
     this.CoinGroupSet              = new CoinGroupSet(this);
     this.CoinSet                   = new CoinSet(this);
     this.FileWriterSet             = new FileWriterSet(this);
     this.FragmentWriterSet         = new FragmentWriterSet(this);
     this.GroupSet                  = new GroupSet(this);
     this.PoolSet                   = new PoolSet(this);
     this.SysDicItemSet             = new SysDicItemSet(this);
     this.SysDicSet                 = new SysDicSet(this);
     this.CoinKernelSet             = new CoinKernelSet(this);
     this.KernelInputSet            = new KernelInputSet(this);
     this.KernelOutputSet           = new KernelOutputSet(this);
     this.KernelOutputTranslaterSet = new KernelOutputTranslaterSet(this);
     this.KernelSet                 = new KernelSet(this);
     this.PackageSet                = new PackageSet(this);
     this.PoolKernelSet             = new PoolKernelSet(this);
 }