Exportar (0) Imprimir
Expandir todo

Application.Run (Método) (Window)

Starts a Windows Presentation Foundation (WPF) application and opens the specified window.

Espacio de nombres: System.Windows
Ensamblado: PresentationFramework (en presentationframework.dll)

public int Run (
	Window window
)
public int Run (
	Window window
)
public function Run (
	window : Window
) : int
No se pueden utilizar métodos en XAML.

Parámetros

window

A Window that opens automatically when an application starts.

Valor devuelto

The Int32 application exit code that is returned to the operating system when the application shuts down. By default, the exit code value is 0.

Tipo de excepciónCondición

InvalidOperationException

Run is called from a browser-hosted application eg an XAML browser application (XBAP).

This overload extends the Run method to open the specified window after an application starts running.

If you define a code Application that opens a window when it starts running, you explicitly call Run.

If you create your Application using markup, or markup and code-behind, you can automatically open a window during using either of the following techniques:

The following example shows an application with a manually-created static entry point method that instantiates Application, before calling Run.

using System;
using System.Windows;

namespace CSharp
{
    public class EntryPoint
    {
        // All WPF applications should execute on a single-threaded apartment (STA) thread
        [STAThread]
        public static void Main()
        {
            Application app = new Application();
            app.Run(new Window());
        }
    }
}

Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.

.NET Framework

Compatible con: 3.0

Adiciones de comunidad

AGREGAR
Mostrar:
© 2015 Microsoft