From 5cecf51ee45cc0856ebc5d71887886f32e710e23 Mon Sep 17 00:00:00 2001 From: Sigmanor Date: Mon, 25 Jan 2016 12:39:30 +0200 Subject: [PATCH] Save on closing bugs fixed --- Crypto Notepad/Form1.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Crypto Notepad/Form1.cs b/Crypto Notepad/Form1.cs index e968150..53610fc 100644 --- a/Crypto Notepad/Form1.cs +++ b/Crypto Notepad/Form1.cs @@ -257,6 +257,11 @@ private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) NameWithotPath = Path.GetFileName(OpenFile.FileName); } + if (NameWithotPath == "") + { + NameWithotPath = noname; + } + if (customRTB.Text != "") { DialogResult res = new DialogResult(); @@ -278,12 +283,13 @@ private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) { saveToolStripMenuItem1_Click_1(this, new EventArgs()); } - Application.Exit(); + + e.Cancel = true; } if (res == DialogResult.No) { - Environment.Exit(0); + return; } if (res == DialogResult.Cancel)