Class Application
Encapsulates the app and its available services.
Inheritance
Inherited Members
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public class Application
Constructors
| Improve this Doc View SourceApplication()
Declaration
public Application()
Properties
| Improve this Doc View SourceApplicationLifetimeObjects
Declaration
public IList ApplicationLifetimeObjects { get; }
Property Value
Type | Description |
---|---|
System.Collections.IList |
Current
Gets the Application object for the current application.
Declaration
public static Application Current { get; }
Property Value
Type | Description |
---|---|
Application |
HasElevatedPermissions
Declaration
[NotImplemented]
public bool HasElevatedPermissions { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Host
Gets various details about the application's host.
Declaration
public Host Host { get; }
Property Value
Type | Description |
---|---|
Host |
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. |
IsRunningOutOfBrowser
Declaration
[NotImplemented]
public bool IsRunningOutOfBrowser { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
MainWindow
Gets the application main window.
Declaration
public Window MainWindow { get; }
Property Value
Type | Description |
---|---|
Window |
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 |
RootVisual
Gets or sets the main application UI. This is an alias for: Window.Current.Content
Declaration
public UIElement RootVisual { get; set; }
Property Value
Type | Description |
---|---|
UIElement |
Windows
Declaration
[NotImplemented]
public WindowCollection Windows { get; }
Property Value
Type | Description |
---|---|
WindowCollection |
Methods
| Improve this Doc View SourceCheckAndDownloadUpdateAsync()
Declaration
[NotImplemented]
public void CheckAndDownloadUpdateAsync()
GetResourceStream(Uri)
Returns a resource stream for a resource data file that is located at the specified System.Uri (see WPF Application Resource, Content, and Data Files).
Declaration
public static async Task<StreamResourceInfo> GetResourceStream(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<StreamResourceInfo> | A System.Windows.Resources.StreamResourceInfo that contains a resource stream for resource data file that is located at the specified System.Uri. |
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 |
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. |
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. |
INTERNAL_RaiseReloadedEvent()
Intended to be called by the Simulator when navigating back from an external page.
Declaration
public static void INTERNAL_RaiseReloadedEvent()
LoadComponent(Object, IXamlComponentLoader)
Declaration
public static void LoadComponent(object component, IXamlComponentLoader loader)
Parameters
Type | Name | Description |
---|---|---|
System.Object | component | |
IXamlComponentLoader | loader |
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 |
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. |
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. |
RunApplication(Action)
The entry point of the application needs to be wrapped by this method to ensure correction functioning of the application.
Declaration
public static void RunApplication(Action entryPoint)
Parameters
Type | Name | Description |
---|---|---|
System.Action | entryPoint |
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 SourceCheckAndDownloadUpdateCompleted
Declaration
[NotImplemented]
public event CheckAndDownloadUpdateCompletedEventHandler CheckAndDownloadUpdateCompleted
Event Type
Type | Description |
---|---|
CheckAndDownloadUpdateCompletedEventHandler |
Exit
Occurs just before an application shuts down and cannot be canceled.
Declaration
public event EventHandler Exit
Event Type
Type | Description |
---|---|
System.EventHandler |
InstallStateChanged
Occurs when the InstallState property value changes.
Declaration
[NotImplemented]
public event EventHandler InstallStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler |
INTERNAL_Reloaded
Declaration
public static event EventHandler INTERNAL_Reloaded
Event Type
Type | Description |
---|---|
System.EventHandler |
Startup
Occurs when an application is started.
Declaration
public event StartupEventHandler Startup
Event Type
Type | Description |
---|---|
StartupEventHandler |
UnhandledException
Occurs when an exception that is raised is not handled.
Declaration
public event EventHandler<ApplicationUnhandledExceptionEventArgs> UnhandledException
Event Type
Type | Description |
---|---|
System.EventHandler<ApplicationUnhandledExceptionEventArgs> |