If 'Close Minimizes' is unchecked then prompt user for confirmation when Main Form is closed

This commit is contained in:
Aziz Rafsanjani 2017-06-25 18:07:48 +00:00
parent 6c0a1a94a9
commit dcd5b74472
4 changed files with 1292 additions and 0 deletions

View File

@ -2166,6 +2166,33 @@ namespace DS4Windows
return; return;
} }
//in case user accidentally clicks on the close button whilst "Close Minimizes" checkbox is unchecked
if (!cBCloseMini.Checked && !contextclose)
{
DS4Device[] devices = Program.rootHub.DS4Controllers;
int controllerLen = devices.Length;
bool nocontrollers = true;
for (Int32 i = 0, PadsLen = Pads.Length; nocontrollers && i < PadsLen; i++)
{
DS4Device d = devices[i];
if (d != null)
{
nocontrollers = false;
}
}
if (!nocontrollers)
{
if (MessageBox.Show(Properties.Resources.CloseConfirm, Properties.Resources.Confirm,
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
e.Cancel = true;
return;
}
}
}
if (cBCloseMini.Checked && !contextclose) if (cBCloseMini.Checked && !contextclose)
{ {
this.WindowState = FormWindowState.Minimized; this.WindowState = FormWindowState.Minimized;

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>