Merge branch 'rafsanjani-confirm-on-close' into jay

This commit is contained in:
Travis Nickles 2017-06-30 06:47:31 -07:00
commit 169281d823
4 changed files with 1290 additions and 1 deletions

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,7 +2167,30 @@ namespace DS4Windows
return; return;
} }
if (cBCloseMini.Checked && !contextclose) 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 (!closeMini && !contextclose)
{
for (int i = 0, PadsLen = Pads.Length; tempBool && i < PadsLen; i++)
{
d = Program.rootHub.DS4Controllers[i];
tempBool = (d != null) ? false : tempBool;
}
bool nocontrollers = tempBool;
if (!nocontrollers)
{
if (MessageBox.Show(Properties.Resources.CloseConfirm, Properties.Resources.Confirm,
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
e.Cancel = true;
return;
}
}
}
else if (closeMini && !contextclose)
{ {
this.WindowState = FormWindowState.Minimized; this.WindowState = FormWindowState.Minimized;
e.Cancel = true; e.Cancel = true;

File diff suppressed because it is too large Load Diff

View File

@ -274,6 +274,15 @@ namespace DS4Windows.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to This will disconnect all your connected controllers. Proceed?.
/// </summary>
internal static string CloseConfirm {
get {
return ResourceManager.GetString("CloseConfirm", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Close DS4Windows?. /// Looks up a localized string similar to Close DS4Windows?.
/// </summary> /// </summary>
@ -310,6 +319,15 @@ namespace DS4Windows.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Confirm....
/// </summary>
internal static string Confirm {
get {
return ResourceManager.GetString("Confirm", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Connecting.... /// Looks up a localized string similar to Connecting....
/// </summary> /// </summary>

View File

@ -787,4 +787,10 @@
<data name="GyroTriggerBehavior" xml:space="preserve"> <data name="GyroTriggerBehavior" xml:space="preserve">
<value>Check to have gyro active while trigger is active. Uncheck to disable gyro while trigger is active.</value> <value>Check to have gyro active while trigger is active. Uncheck to disable gyro while trigger is active.</value>
</data> </data>
<data name="CloseConfirm" xml:space="preserve">
<value>This will disconnect all your connected controllers. Proceed?</value>
</data>
<data name="Confirm" xml:space="preserve">
<value>Confirm...</value>
</data>
</root> </root>