private void btnOk_Click(object sender, EventArgs e) { ConfirmSuccess = ValidateInput(tbInput.Text); DialogResult = DialogResult.OK; openForm = null; Close(); }
private void btnDeleteDB_Click(object sender, EventArgs e) { //if (MessageBox.Show("Did you think about it? Are you sure?", "Are you sure?", MessageBoxButtons.YesNo) == // DialogResult.Yes) FrmConfirmDelete confirm = FrmConfirmDelete.GetInstance(); if (FrmConfirmDelete.openForm != null) { confirm.Focus(); } if (confirm.ShowDialog() == DialogResult.OK) { if (confirm.ConfirmSuccess) { if (File.Exists(Path.Combine( Path.GetDirectoryName(Application.ExecutablePath) ?? throw new InvalidOperationException(), "EZRaffle.sqlite"))) { File.Delete(Path.Combine( Path.GetDirectoryName(Application.ExecutablePath) ?? throw new InvalidOperationException(), "EZRaffle.sqlite")); InitializeControls(); } } } }
public static FrmConfirmDelete GetInstance() { if (openForm == null) { openForm = new FrmConfirmDelete(); openForm.FormClosed += delegate { openForm = null; }; } return(openForm); }