Szerkesztés

Megosztás a következőn keresztül:


Application.Shutdown Method

Definition

Shuts down an application.

Overloads

Shutdown()

Shuts down an application.

Shutdown(Int32)

Shuts down an application that returns the specified exit code to the operating system.

Shutdown()

Shuts down an application.

public:
 void Shutdown();
public void Shutdown ();
member this.Shutdown : unit -> unit
Public Sub Shutdown ()

Remarks

When Shutdown is called, an application stops running. You can handle the Exit event to detect when an application is about to stop running, to perform any appropriate processing.

Shutdown is implicitly called by Windows Presentation Foundation in the following situations:

Calling Shutdown explicitly causes an application to shut down, regardless of the ShutdownMode setting. However, if ShutdownMode is set to OnExplicitShutdown, you must call Shutdown to shut down an application.

Important

When Shutdown is called, the application will shut down irrespective of whether the Closing event of any open windows is canceled.

This method can be called only from the thread that created the Application object.

See also

Applies to

Shutdown(Int32)

Shuts down an application that returns the specified exit code to the operating system.

public:
 void Shutdown(int exitCode);
[System.Security.SecurityCritical]
public void Shutdown (int exitCode);
public void Shutdown (int exitCode);
[<System.Security.SecurityCritical>]
member this.Shutdown : int -> unit
member this.Shutdown : int -> unit
Public Sub Shutdown (exitCode As Integer)

Parameters

exitCode
Int32

An integer exit code for an application. The default exit code is 0.

Attributes

Remarks

You can handle the Exit event to set an exit code. However, if you explicitly call Shutdown, and you handle Exit only to set an exit code, you can call Shutdown instead.

This method can be called only from the thread that created the Application object.

See Environment.ExitCode for information on exit codes.

See also

Applies to