mirror of
https://github.com/Crypto-Notepad/Crypto-Notepad.git
synced 2026-03-11 08:55:25 +00:00
Fixed bug when did not appear save dialog on app close #46
This commit is contained in:
parent
1ad5ddbb4e
commit
0a52852435
1 changed files with 22 additions and 0 deletions
|
|
@ -789,6 +789,28 @@ private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
|
|||
DialogResult res = MessageBox.Show(this, messageBoxText, PublicVar.appName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||
if (res == DialogResult.Yes)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
saveFileDialog.FileName = "Unnamed.cnp";
|
||||
if (saveFileDialog.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
EnterKeyForm enterKeyForm = new EnterKeyForm
|
||||
{
|
||||
Owner = this
|
||||
};
|
||||
enterKeyForm.ShowDialog();
|
||||
if (!PublicVar.okPressed)
|
||||
{
|
||||
PublicVar.openFileName = Path.GetFileName(filePath);
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
PublicVar.encryptionKey.Set(TypedPassword.Value);
|
||||
filePath = saveFileDialog.FileName;
|
||||
}
|
||||
Hide();
|
||||
trayIcon.Visible = false;
|
||||
using (StreamWriter writer = new StreamWriter(filePath))
|
||||
|
|
|
|||
Loading…
Reference in a new issue