From dbc33d1986ecc1e74b0a807212094b61b332e157 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Fri, 30 Jun 2017 06:46:54 -0700 Subject: [PATCH] Tweak routine for runtime --- DS4Windows/DS4Forms/DS4Form.cs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index e018768..5354b01 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -2157,6 +2157,7 @@ namespace DS4Windows linkSetup.LinkColor = Color.Blue; } + bool tempBool = false; protected void ScpForm_Closing(object sender, FormClosingEventArgs e) { if (opt.Visible) @@ -2166,22 +2167,19 @@ namespace DS4Windows return; } + bool closeMini = tempBool = cBCloseMini.Checked; + DS4Device d = null; + tempBool = true; //in case user accidentally clicks on the close button whilst "Close Minimizes" checkbox is unchecked - if (!cBCloseMini.Checked && !contextclose) + if (!closeMini && !contextclose) { - DS4Device[] devices = Program.rootHub.DS4Controllers; - int controllerLen = devices.Length; - bool nocontrollers = true; - - for (Int32 i = 0, PadsLen = Pads.Length; nocontrollers && i < PadsLen; i++) + for (int i = 0, PadsLen = Pads.Length; tempBool && i < PadsLen; i++) { - DS4Device d = devices[i]; - if (d != null) - { - nocontrollers = false; - } + d = Program.rootHub.DS4Controllers[i]; + tempBool = (d != null) ? false : tempBool; } + bool nocontrollers = tempBool; if (!nocontrollers) { if (MessageBox.Show(Properties.Resources.CloseConfirm, Properties.Resources.Confirm, @@ -2192,8 +2190,7 @@ namespace DS4Windows } } } - - if (cBCloseMini.Checked && !contextclose) + else if (closeMini && !contextclose) { this.WindowState = FormWindowState.Minimized; e.Cancel = true;