private void MedicalCardForm_FormClosing(object sender, FormClosingEventArgs e) { if (!textBox1.ReadOnly) { DialogResult dr = MessageBox.Show("Сохранить изменения?", "Сохранить?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { WriteToMedicalCard?.Invoke(this, new MedicalCardEventAgs(Editor.GetId(comboBox1.SelectedItem.ToString()), Editor.GetByteRepresentation(textBox1.Lines, LastLineIndex))); } } }
private void button2_Click(object sender, EventArgs e) { if (DialogResult.OK == MessageBox.Show("Вы уверены, что хотите применить изменения?", "Сохранить?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { SetTrueFalse(true, 1); SetTrueFalse(true, 2); WriteToMedicalCard?.Invoke(this, new MedicalCardEventAgs(Editor.GetId(comboBox1.SelectedItem.ToString()), Editor.GetByteRepresentation(textBox1.Lines, LastLineIndex))); TextBoxContent = textBox1.Text; LastLineIndex = textBox1.Lines.Length; textBox1.ReadOnly = true; Cancel.Enabled = false; comboBox3.Text = ""; comboBox4.Text = ""; } button4.Enabled = true; }