protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { DrawTimer?.Stop(); System.Threading.Thread.Sleep(50); if (LEDSetup.ActivePort != null) { if (LEDSetup.ActivePort.IsOpen) { LEDSetup.drawOff(); } } TrayIcon.Dispose(); sColors.stopFluxListener(); Logger.QueueLine("Application closing"); base.OnClosing(e); }
void PowerManager_IsMonitorOnChanged(object sender, EventArgs e) { if (PowerManager.IsMonitorOn) { Logger.QueueLine("Monitor has turned on, resuming LEDs"); LEDSetup.LEDS_ON = true; if (LEDSetup.ActivePort != null) { if (sColors != null) { DrawTimer.Start(); } if (aColors != null) { aColors.wi.StartRecording(); } } } else { Logger.QueueLine("Monitor has turned off, disabling LEDs"); LEDSetup.LEDS_ON = false; if (LEDSetup.ActivePort != null) { if (sColors != null) { DrawTimer.Stop(); } if (aColors != null) { aColors.wi.StopRecording(); } System.Threading.Thread.Sleep(50); LEDSetup.drawOff(); } } }