From da3a1d1fe9e6feabdf5a7ee589d422d16675698a Mon Sep 17 00:00:00 2001 From: VladMordock Date: Sun, 28 Feb 2021 11:41:48 +0100 Subject: [PATCH] Fix: inproper closure while connections open --- 02_Windows_App/Perun_v1/02_Forms/form_Main.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs index d4abe42..d15a09e 100644 --- a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs +++ b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs @@ -399,17 +399,22 @@ namespace Perun_v1 private void con_Button_Quit_Click(object sender, EventArgs e) { // Try to close app - DialogResult dialogResult = MessageBox.Show("Are you sure to exit Perun?", "Question", MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); - if (dialogResult == DialogResult.Yes) + if (tim_MySQL.Enabled == false) { - form_Main_SaveSettings(); + DialogResult dialogResult = MessageBox.Show("Are you sure to exit Perun?", "Question", MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); + if (dialogResult == DialogResult.Yes) + { + form_Main_SaveSettings(); - AppCanClose = true; // Save settings on exit - this.Close(); // Allow to exit application - } - else if (dialogResult == DialogResult.No) - { - //do nothing + AppCanClose = true; // Save settings on exit + this.Close(); // Allow to exit application + } + else if (dialogResult == DialogResult.No) + { + //do nothing + } + } else { + MessageBox.Show("You cannot exit Perun while the connections are open. Stop the server and try again."); } }