Interface IApp
Contract for Meadow applications. Provides a way for the Meadow OS to communicate with Meadow applications when system events are happening.
Assembly: Meadow.Contracts.dll
View Source
public interface IApp
Properties
Version
The application's version number
View Source
public static Version Version { get; }
Settings
Settings parsed from the app.config.yaml at startup
View Source
Dictionary<string, string> Settings { get; }
CancellationToken
A cancellation token that is canceled when the application is signaled to shut down
View Source
CancellationToken CancellationToken { get; }
Methods
InvokeOnMainThread(Action<object?>, object?)
Use this method to invoke actions on the application's startup thread
View Source
void InvokeOnMainThread(Action<object?> action, object? state = null)
Parameters
Type | Name | Description |
---|---|---|
System.Action<System.Object> | action | The action to invoke |
System.Object | state | Optional state data to pass to the Action |
Initialize()
Called when the application is being brought up.
View Source
Task Initialize()
Returns
System.Threading.Tasks.Task
Run()
The core of the app's work and logic
View Source
Task Run()
Returns
System.Threading.Tasks.Task
OnShutdown()
Called if the app is being brought down.
View Source
Task OnShutdown()
Returns
System.Threading.Tasks.Task
OnError(Exception)
Called if a failure occurred while running the app
View Source
Task OnError(Exception e)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|---|
System.Exception | e |
OnUpdate(Version, out bool)
Called when the application is about to update itself.
View Source
void OnUpdate(Version newVersion, out bool approveUpdate)
Parameters
Type | Name |
---|---|
System.Version | newVersion |
System.Boolean | approveUpdate |
OnUpdateComplete(Version, out bool)
Called when the application has updated itself.
View Source
void OnUpdateComplete(Version oldVersion, out bool rollbackUpdate)
Parameters
Type | Name |
---|---|
System.Version | oldVersion |
System.Boolean | rollbackUpdate |