Show / Hide Table of Contents

    Class Application

    Application base class

    Inheritance
    Object
    DispatcherObject
    Application
    Implements
    IEventListener
    Inherited Members
    DispatcherObject.CheckAccess()
    DispatcherObject.VerifyAccess()
    DispatcherObject.Dispatcher
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: nanoFramework.UI
    Assembly: nanoFramework.Graphics.dll
    Syntax
    public class Application : DispatcherObject, IEventListener

    Constructors

    | Improve this Doc View Source

    Application()

    Initializes a new instance of the Application class.

    Declaration
    public Application()

    Properties

    | Improve this Doc View Source

    Current

    The Current property enables the developer to always get to the application in AppDomain in which they are running.

    Declaration
    public static Application Current { get; }
    Property Value
    Type Description
    Application
    | Improve this Doc View Source

    MainWindow

    The MainWindow property indicates the primary window of the application.

    Declaration
    public Window MainWindow { get; set; }
    Property Value
    Type Description
    Window
    Remarks

    By default - MainWindow will be set to the first window opened in the application. However the MainWindow may be set programmatically to indicate "this is my main window". It is a recommended programming style to refer to MainWindow in code instead of Windows[0].

    | Improve this Doc View Source

    ShutdownMode

    The ShutdownMode property is called to set the shutdown specific mode of the application. Setting this property controls the way in which an application will shutdown. The three values for the ShutdownMode enum are : OnLastWindowClose OnMainWindowClose OnExplicitShutdown

    OnLastWindowClose - this mode will shutdown the application when the last window is closed, or an explicit call is made to Application.Shutdown(). This is the default mode.

    OnMainWindowClose - this mode will shutdown the application when the main window has been closed, or Application.Shutdown() is called. Note that if the MainWindow property has not been set - this mode is equivalent to OnExplicitOnly.

    OnExplicitShutdown- this mode will shutdown the application only when an explicit call to OnShutdown() has been made.

    Declaration
    public ShutdownMode ShutdownMode { get; set; }
    Property Value
    Type Description
    ShutdownMode
    | Improve this Doc View Source

    Windows

    The Windows property exposes a WindowCollection object, from which a developer can iterate over all the windows that have been opened in the current application.

    Declaration
    public WindowCollection Windows { get; }
    Property Value
    Type Description
    WindowCollection

    Methods

    | Improve this Doc View Source

    InitializeForEventSource()

    Declaration
    public void InitializeForEventSource()
    | Improve this Doc View Source

    OnEvent(BaseEvent)

    Declaration
    public bool OnEvent(BaseEvent ev)
    Parameters
    Type Name Description
    BaseEvent ev
    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    OnExit(EventArgs)

    OnExit is called to raise the Exit event. The developer will typically override this method if they want to take action when the application exits ( or they may choose to attach an event).

    Declaration
    protected virtual void OnExit(EventArgs e)
    Parameters
    Type Name Description
    EventArgs e

    The event args that will be passed to the Exit event

    Remarks

    This method follows the .Net programming guideline of having a protected virtual method that raises an event, to provide a convenience for developers that subclass the event. If you override this method - you need to call Base.OnExit(...) for the corresponding event to be raised.

    | Improve this Doc View Source

    OnStartup(EventArgs)

    OnStartup is called to raise the Startup event. The developer will typically override this method if they want to take action at startup time ( or they may choose to attach an event). This method will be called once when the application begins, once that application's Run() method has been called.

    Declaration
    protected virtual void OnStartup(EventArgs e)
    Parameters
    Type Name Description
    EventArgs e

    The event args that will be passed to the Startup event

    Remarks

    This method follows the .Net programming guideline of having a protected virtual method that raises an event, to provide a convenience for developers that subclass the event. If you override this method - you need to call Base.OnStartup(...) for the corresponding event to be raised.

    | Improve this Doc View Source

    Run()

    Run is called to start an application.

    Typically a developer will do some setting of properties/attaching to events after instantiating an application object, and then call Run() to start the application.

    Declaration
    public void Run()
    Remarks

    Once run has been called - an application's OnStartup override and Startup event is called immediately afterwards.

    | Improve this Doc View Source

    Run(Window)

    Run is called to start an application.

    Typically a developer will do some setting of properties/attaching to events after instantiating an application object, and then call Run() to start the application.

    Declaration
    public void Run(Window window)
    Parameters
    Type Name Description
    Window window

    Window that will be added to the Windows property and made the MainWindow of the Applcation. The passed Window must be created on the same thread as the Application object. Furthermore, this Window is shown once the Application is run.

    Remarks

    Once run has been called - an application's OnStartup override and Startup event is called immediately afterwards.

    | Improve this Doc View Source

    Shutdown()

    Shutdown is called to programmatically shutdown an application.

    Once shutdown() is called, the application gets called with the OnShutdown method to raise the Shutdown event.

    Declaration
    public void Shutdown()

    Events

    | Improve this Doc View Source

    Exit

    The Exit event is fired when an application is shutting down. This event is raised by the OnExit method.

    Declaration
    public event EventHandler Exit
    Event Type
    Type Description
    EventHandler
    | Improve this Doc View Source

    Startup

    The Startup event is fired when an application is starting. This event is raised by the OnStartup method.

    Declaration
    public event EventHandler Startup
    Event Type
    Type Description
    EventHandler

    Implements

    IEventListener

    Extension Methods

    LogDispatcher.GetCurrentClassLogger(Object)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018 nanoFramework Contributors
    Generated by DocFX