예제 #1
0
        // TODO create a private task and await that
        private static async void IdleTick(object sender, IdleChangedEventArgs e)
        {
            if (MiningState.Instance.MiningManuallyStarted || !IdleMiningSettings.Instance.StartMiningWhenIdle)
            {
                return;
            }

            if (e.IsIdle)
            {
                Logger.Info("IDLECHECK", "Entering idling state");
                await ApplicationStateManager.StartAllAvailableDevicesTask();
            }
            else if (MiningState.Instance.IsCurrentlyMining)
            {
                await ApplicationStateManager.StopAllDevicesTask();

                Logger.Info("IDLECHECK", "Resumed from idling");
            }
        }
        private static void IdleTick(object sender, IdleChangedEventArgs e)
        {
            if (MiningState.Instance.MiningManuallyStarted || !ConfigManager.GeneralConfig.StartMiningWhenIdle)
            {
                return;
            }

            if (e.IsIdle)
            {
                if (ApplicationStateManager.IsInMainForm)
                {
                    Logger.Info("IDLECHECK", "Entering idling state");
                    ApplicationStateManager.StartAllAvailableDevices();
                }
            }
            else if (MiningState.Instance.IsCurrentlyMining)
            {
                ApplicationStateManager.StopAllDevice();
                Logger.Info("IDLECHECK", "Resumed from idling");
            }
        }