protected override void OnFormClosing(FormClosingEventArgs e) { if (mainLoop.IsBusy) { closePending = true; mainLoop.CancelAsync(); e.Cancel = true; Hide(); return; } MysticLightSDK.Shutdown(); LogitechGSDK.Shutdown(); base.OnFormClosing(e); }
private void BtnStop_Click(object sender, EventArgs e) { if (mainLoop.IsBusy) { NumBoxX.Enabled = true; NumBoxY.Enabled = true; NumBoxScale.Enabled = true; ComboRes.Enabled = true; if (MysticLightSDK.Ready()) { MysticLightSDK.Shutdown(); } if (LogitechGSDK.Ready()) { LogitechGSDK.Shutdown(); } mainLoop.CancelAsync(); StatusLabel.Text = "Stopped."; } LightsOff(); }