You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Remote Server/ServerForm.cs
+25-13Lines changed: 25 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -161,6 +161,7 @@ public partial class ServerForm : Form
161
161
internalconststringMINIMISE_ON_START_PROFILENAME="Minimise On Start";publicconstboolMINIMISE_ON_START_DEFAULT=false;
162
162
internalconststringCHECK_FOR_UPDATES="Check For Updates";publicconstboolCHECK_FOR_UPDATES_DEFAULT=true;
163
163
internalconststringCHECK_FOR_PRE_RELEASE="Check For Pre-release Updates";publicconstboolCHECK_FOR_PRE_RELEASE_DEFAULT=true;
164
+
internalconststringSUPPRESS_CONFIRMATION_ON_WINDOWS_CLOSE="Suppress Confirmation On Windows Close";publicconstboolSUPPRESS_CONFIRMATION_ON_WINDOWS_CLOSE_DEFAULT=false;
164
165
165
166
// Minimise behaviour strings
166
167
internalconststringMINIMISE_TO_SYSTEM_TRAY_KEY="Minimise to system tray";
@@ -282,6 +283,7 @@ public partial class ServerForm : Form
// Check whether the server is configured to ask for shutdown confirmation
1980
+
LogMessage(0,0,0,"ServerForm_FormClosing",$"Confirm exit: {ConfirmExit}, Suppress on Windows shutdown: {SuppressConfirmationOnWindowsClose}, Shutdown reason: {e.CloseReason}");
1981
+
// Check whether the Remote server is configured to ask for shutdown confirmation
1977
1982
if(ConfirmExit)// Confirmation is required
1978
-
{
1979
-
// Ask the user whether they want to close the remote server
1980
-
DialogResultresult=MessageBox.Show("Are you sure you want to close the Remote Server?","ASCOM Remote Server",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
1981
-
1982
-
// An OK result means the user wants to shut down the Remote Server so allow the form to close, otherwise cancel the close.
1983
-
if(result!=DialogResult.OK)
1984
-
e.Cancel=true;
1985
-
}
1986
-
else// No confirmation is required so go ahead and let the application shut down.
1987
-
{
1988
-
// No action required
1989
-
}
1983
+
{
1984
+
// Check whether the system is shutting down and whether or not we are suppressing the close dialogue on Windows shutdown
1985
+
if(e.CloseReason==CloseReason.WindowsShutDown&SuppressConfirmationOnWindowsClose)// Windows is shutting down and we are suppressing the close dialogue
1986
+
{
1987
+
// No action required
1988
+
}
1989
+
else// A close down confirmation dialogue is required.
1990
+
{
1991
+
// Ask the user whether they want to close the remote server
1992
+
DialogResultresult=MessageBox.Show("Are you sure you want to close the Remote Server?","ASCOM Remote Server",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
1990
1993
1994
+
// An OK result means the user wants to shut down the Remote Server so allow the form to close, otherwise cancel the close.
1995
+
if(result!=DialogResult.OK)
1996
+
e.Cancel=true;
1997
+
}
1998
+
}
1999
+
else// No confirmation is required so go ahead and let the application shut down.
0 commit comments