private void NewToolStripMenuItem_Click(object sender, EventArgs e) { if (CRUD.autosave) { CRUD.autosave = false; } if (CRUD.isaved) { filedb.Text = CRUD.path = null; CRUD.isaved = true; autoSave.Checked = CRUD.autosave; this.Text = CRUD.name(); } else { var sys = new sys("Do you want to save this ?", filedb.Text); sys.ShowDialog(); if (!CRUD.answer) { CRUD.isaved = true; CRUD.path = filedb.Text = null; } } CRUD.answer = true; }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (!CRUD.autosave) { if (!CRUD.isaved && (CRUD.path != null || filedb.Text.Length > 1)) { var sys = new sys("Do you want to save this ?", filedb.Text); sys.ShowDialog(); } e.Cancel = !CRUD.answer; } }