Tweak routine for runtime

This commit is contained in:
Travis Nickles 2017-06-30 06:46:54 -07:00
parent 625483530a
commit dbc33d1986

View File

@ -2157,6 +2157,7 @@ namespace DS4Windows
linkSetup.LinkColor = Color.Blue; linkSetup.LinkColor = Color.Blue;
} }
bool tempBool = false;
protected void ScpForm_Closing(object sender, FormClosingEventArgs e) protected void ScpForm_Closing(object sender, FormClosingEventArgs e)
{ {
if (opt.Visible) if (opt.Visible)
@ -2166,22 +2167,19 @@ namespace DS4Windows
return; 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 //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; for (int i = 0, PadsLen = Pads.Length; tempBool && i < PadsLen; i++)
int controllerLen = devices.Length;
bool nocontrollers = true;
for (Int32 i = 0, PadsLen = Pads.Length; nocontrollers && i < PadsLen; i++)
{ {
DS4Device d = devices[i]; d = Program.rootHub.DS4Controllers[i];
if (d != null) tempBool = (d != null) ? false : tempBool;
{
nocontrollers = false;
}
} }
bool nocontrollers = tempBool;
if (!nocontrollers) if (!nocontrollers)
{ {
if (MessageBox.Show(Properties.Resources.CloseConfirm, Properties.Resources.Confirm, if (MessageBox.Show(Properties.Resources.CloseConfirm, Properties.Resources.Confirm,
@ -2192,8 +2190,7 @@ namespace DS4Windows
} }
} }
} }
else if (closeMini && !contextclose)
if (cBCloseMini.Checked && !contextclose)
{ {
this.WindowState = FormWindowState.Minimized; this.WindowState = FormWindowState.Minimized;
e.Cancel = true; e.Cancel = true;