Show / Hide Table of Contents

Class Application

Encapsulates the app and its available services.

Inheritance
System.Object
Application
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public class Application

Constructors

| Improve this Doc View Source

Application()

Declaration
public Application()
| Improve this Doc View Source

Application(String)

Declaration
public Application(string rootDivId)
Parameters
Type Name Description
System.String rootDivId

Properties

| Improve this Doc View Source

ApplicationLifetimeObjects

Declaration
public IList ApplicationLifetimeObjects { get; }
Property Value
Type Description
System.Collections.IList
| Improve this Doc View Source

Current

Gets the Application object for the current application.

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

HasElevatedPermissions

Declaration
[NotImplemented]
public bool HasElevatedPermissions { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Host

Gets various details about the application's host.

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

InstallState

Gets the current out-of-browser installation state of the application.

Declaration
[NotImplemented]
public InstallState InstallState { get; }
Property Value
Type Description
InstallState

The out-of-browser installation state of the application.

| Improve this Doc View Source

IsRunningOutOfBrowser

Declaration
[NotImplemented]
public bool IsRunningOutOfBrowser { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

MainWindow

Gets the application main window.

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

Resources

Gets a collection of application-scoped resources, such as styles, templates, and brushes.

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

RootVisual

Gets or sets the main application UI. This is an alias for the Content of this application's MainWindow.

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

Theme

Gets or sets the Theme used across this Application.

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

Windows

Gets a collection of the Window instances that have been created.

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

A collection of the windows used by the application.

Methods

| Improve this Doc View Source

CheckAndDownloadUpdateAsync()

Declaration
[NotImplemented]
public void CheckAndDownloadUpdateAsync()
| Improve this Doc View Source

GetResourceStream(Uri)

Returns a resource file from a location in the application package.

Declaration
public static Task<StreamResourceInfo> GetResourceStream(Uri uriResource)
Parameters
Type Name Description
System.Uri uriResource

A relative URI that identifies the resource file to be loaded. The URI is relative to the application package and does not need a leading forward slash.

Returns
Type Description
System.Threading.Tasks.Task<StreamResourceInfo>

A StreamResourceInfo that contains the stream for the desired resource file.

Exceptions
Type Condition
System.ArgumentNullException

uriResource is null.

System.ArgumentException

uriResource is an absolute URI.

| Improve this Doc View Source

GetResourceStream(StreamResourceInfo, Uri)

Declaration
[NotImplemented]
public static StreamResourceInfo GetResourceStream(StreamResourceInfo zipPackageStreamResourceInfo, Uri uriResource)
Parameters
Type Name Description
StreamResourceInfo zipPackageStreamResourceInfo
System.Uri uriResource
Returns
Type Description
StreamResourceInfo
| Improve this Doc View Source

GetResourceString(Uri)

Returns a string that contains the content of the file that is located at the specified System.Uri.

Declaration
public static Task<string> GetResourceString(Uri uriResource)
Parameters
Type Name Description
System.Uri uriResource

The System.Uri that maps to an embedded resource.

Returns
Type Description
System.Threading.Tasks.Task<System.String>

A string that contains the content of the file that is located at the specified System.Uri.

| Improve this Doc View Source

Install()

Attempts to install the application so that it can run outside the browser.

Declaration
[NotImplemented]
public bool Install()
Returns
Type Description
System.Boolean

true if the user gave consent to install the application or the application requires elevated trust; otherwise, false. See Remarks for more information.

Exceptions
Type Condition
System.InvalidOperationException

The application is already installed.-or-The application is hosted at a URI with a scheme other than http, https, or file.

| Improve this Doc View Source

LoadComponent(Object, IXamlComponentLoader)

Declaration
public static void LoadComponent(object component, IXamlComponentLoader loader)
Parameters
Type Name Description
System.Object component
IXamlComponentLoader loader
| Improve this Doc View Source

LoadComponent(Object, Uri)

Create logic tree from given resource Locator, and associate this tree with the given component.

Declaration
public static void LoadComponent(object component, Uri resourceLocator)
Parameters
Type Name Description
System.Object component

Root Element

System.Uri resourceLocator

Resource Locator

| Improve this Doc View Source

OnExit(EventArgs)

Raises the Exit event

Declaration
protected virtual void OnExit(EventArgs eventArgs)
Parameters
Type Name Description
System.EventArgs eventArgs

The arguments for the event.

| Improve this Doc View Source

OnLaunched(LaunchActivatedEventArgs)

Invoked when the application is launched. Override this method to perform application initialization and to display initial content in the associated Window.

Declaration
protected virtual void OnLaunched(LaunchActivatedEventArgs args)
Parameters
Type Name Description
LaunchActivatedEventArgs args

Event data for the event.

| Improve this Doc View Source

TryFindResource(Object)

Searches for the specified resource.

Declaration
public object TryFindResource(object resourceKey)
Parameters
Type Name Description
System.Object resourceKey

The name of the resource to find.

Returns
Type Description
System.Object

The requested resource object. If the requested resource is not found, a null reference is returned.

Events

| Improve this Doc View Source

CheckAndDownloadUpdateCompleted

Declaration
[NotImplemented]
public event CheckAndDownloadUpdateCompletedEventHandler CheckAndDownloadUpdateCompleted
Event Type
Type Description
CheckAndDownloadUpdateCompletedEventHandler
| Improve this Doc View Source

Exit

Occurs just before an application shuts down and cannot be canceled.

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

InstallStateChanged

Occurs when the InstallState property value changes.

Declaration
[NotImplemented]
public event EventHandler InstallStateChanged
Event Type
Type Description
System.EventHandler
| Improve this Doc View Source

Startup

Occurs when an application is started.

Declaration
public event StartupEventHandler Startup
Event Type
Type Description
StartupEventHandler
| Improve this Doc View Source

UnhandledException

Occurs when an exception that is raised is not handled.

Declaration
public event EventHandler<ApplicationUnhandledExceptionEventArgs> UnhandledException
Event Type
Type Description
System.EventHandler<ApplicationUnhandledExceptionEventArgs>
  • Improve this Doc
  • View Source