PreventShutdownContext Constructor
Namespace: DevCase.Core.IO.Devices.PowerAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public PreventShutdownContext(
string reason,
bool throwOnError = true
)
Public Sub New (
reason As String,
Optional throwOnError As Boolean = true
)
Dim reason As String
Dim throwOnError As Boolean
Dim instance As New PreventShutdownContext(reason,
throwOnError)
public:
PreventShutdownContext(
String^ reason,
bool throwOnError = true
)
new :
reason : string *
?throwOnError : bool
(* Defaults:
let _throwOnError = defaultArg throwOnError true
*)
-> PreventShutdownContext
No code example is currently available or this language may not be supported.
Parameters
- reason String
-
The reason for which the current application must prevent system shutdown.
Because users are typically in a hurry when shutting down the system,
they may spend only a few seconds looking at the shutdown reasons that are displayed by the system.
Therefore, it is important that your reason strings are short and clear.
- throwOnError Boolean (Optional)
-
If , an exception will be thrown if
the application does not meet the requirements to prevent a system shutdown.
Default value is .
InvalidOperationException
|
Applications without a user interface can't prevent a system shutdown.
|
InvalidOperationException
|
The main window of the current application is not yet created or is not visible.
|
InvalidOperationException
|
Only the thread that created the main window of the current application can call this to prevent a system shutdown.
|
SecurityException
|
The user does not have the permissions required to create or modify 'AutoEndTasks' registry value.
Therefore, the application can't prevent a system shutdown.
|