private void buttonConnect_Click(object sender, EventArgs e) { buttonConnect.Enabled = false; this.UseWaitCursor = true; try { if (_Device.IsConnected) { _Device.Terminate(); } else { if (_Device.Init() != 0) { MessageBox.Show("Failed to connect."); } } } finally { buttonConnect.Enabled = true; this.UseWaitCursor = false; } }
internal static void Terminate() { _Device.Terminate(); _Configuration.Save(); Application.ExitThread(); }