From 25be090c896a535c8dd094a6cb4938e446f88e3e Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Mon, 3 Jul 2017 17:33:45 -0500 Subject: [PATCH] Only pop up confirm window when user explicitly closes application. Related to issue #82. --- DS4Windows/DS4Forms/DS4Form.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index 265bca3..b60cbb1 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -2168,10 +2168,11 @@ namespace DS4Windows } bool closeMini = tempBool = cBCloseMini.Checked; + bool userClosing = e.CloseReason == CloseReason.UserClosing; DS4Device d = null; - tempBool = true; + bool nocontrollers = tempBool = true; //in case user accidentally clicks on the close button whilst "Close Minimizes" checkbox is unchecked - if (!closeMini && !contextclose) + if (userClosing && !closeMini && !contextclose) { for (int i = 0, PadsLen = Pads.Length; tempBool && i < PadsLen; i++) { @@ -2179,7 +2180,7 @@ namespace DS4Windows tempBool = (d != null) ? false : tempBool; } - bool nocontrollers = tempBool; + nocontrollers = tempBool; if (!nocontrollers) { if (MessageBox.Show(Properties.Resources.CloseConfirm, Properties.Resources.Confirm, @@ -2190,7 +2191,7 @@ namespace DS4Windows } } } - else if (closeMini && !contextclose) + else if (userClosing && closeMini && !contextclose) { this.WindowState = FormWindowState.Minimized; e.Cancel = true;