Exemple #1
0
 private static void Application_ApplicationExit(object sender, EventArgs e)
 {
     if (_controller != null)
     {
         _controller.Stop();
         _controller = null;
     }
 }
Exemple #2
0
        private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
        {
            switch (e.Mode)
            {
            case PowerModes.Resume:
                Logging.Info("os wake up");
                if (_controller != null)
                {
                    System.Timers.Timer timer = new System.Timers.Timer(5 * 1000);
                    timer.Elapsed  += Timer_Elapsed;
                    timer.AutoReset = false;
                    timer.Enabled   = true;
                    timer.Start();
                }
                break;

            case PowerModes.Suspend:
                _controller?.Stop();
                Logging.Info("os suspend");
                break;
            }
        }