private void Panel_ExitThinButton_Click(object sender, EventArgs e) { if (ComPort_ConnectBtn.Text == "Disconnect") /* Check key status */ { SerialPort_Connection.Close(); /* Close port */ /* ----------------------------------- */ ComPort_ScanBtn.Enabled = true; /* Enable scan btn */ ComPort_ComboBox.Enabled = true; /* Enable combobox */ /* ----------------------------------- */ ComPort_ConnectBtn.Activecolor = Color.FromArgb(0, 195, 175); /* Set color */ ComPort_ConnectBtn.Normalcolor = Color.FromArgb(0, 195, 175); /* Set color */ ComPort_ConnectBtn.OnHovercolor = Color.FromArgb(0, 175, 175); /* Set color */ ComPort_ConnectBtn.Text = "Connect"; /* Change button text */ } ExitForm.ShowExitMessage(); /* Show exit message */ }
void MainForm_Closing(object sender, CancelEventArgs e) { isBusy = true; if ((listViewRegs.Visible && cache.IsTempRegsListChanged()) || listViewDefs.Visible || listViewConts.Visible) { MessageBox.Show("Для завершения работы перейдите к списку изделий", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); isBusy = false; e.Cancel = true; return; } ExitForm form = new ExitForm(); if (form.ShowDialog() == DialogResult.Cancel) { isBusy = false; e.Cancel = true; return; } //if (dcdEvent.IsListening) dcdEvent.StopScanListener(); cache.SaveCache(); }
public static void ShowExitMessage() { ExitForm ExitMessage = new ExitForm(); /* Create object */ ExitMessage.ShowDialog(); /* Show message */ }