From 4381714966329d903266b781ae68ca4b43c57f65 Mon Sep 17 00:00:00 2001 From: Sigmanor Date: Sun, 24 Jan 2016 23:00:03 +0200 Subject: [PATCH] Changed message text on windows closing --- Crypto Notepad/Form1.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Crypto Notepad/Form1.cs b/Crypto Notepad/Form1.cs index d5e001a..3eb1565 100644 --- a/Crypto Notepad/Form1.cs +++ b/Crypto Notepad/Form1.cs @@ -254,12 +254,22 @@ private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) { string f = "Unnamed.cnp"; + string NameWithotPath; + try + { + NameWithotPath = Path.GetFileName(args[1]); + } + catch (IndexOutOfRangeException) + { + NameWithotPath = Path.GetFileName(OpenFile.FileName); + } + if (customRTB.Text != "") { DialogResult res = new DialogResult(); using (new CenterWinDialog(this)) { - res = MessageBox.Show("Save changes in:\n" + filename + " ?", + res = MessageBox.Show("Save file: " + "\"" + NameWithotPath + "\"" + " ? ", "Crypto Notepad", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);