Skip to main content

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
Declaration
public interface IApp

Properties

Version

The application's version number

View Source
Declaration
public static Version Version { get; }

Settings

Settings parsed from the app.config.yaml at startup

View Source
Declaration
Dictionary<string, string> Settings { get; }

CancellationToken

A cancellation token that is canceled when the application is signaled to shut down

View Source
Declaration
CancellationToken CancellationToken { get; }

Methods

InvokeOnMainThread(Action<object?>, object?)

Use this method to invoke actions on the application's startup thread

View Source
Declaration
void InvokeOnMainThread(Action<object?> action, object? state = null)
Parameters
TypeNameDescription
System.Action<System.Object>actionThe action to invoke
System.ObjectstateOptional state data to pass to the Action

Initialize()

Called when the application is being brought up.

View Source
Declaration
Task Initialize()
Returns

System.Threading.Tasks.Task

Run()

The core of the app's work and logic

View Source
Declaration
Task Run()
Returns

System.Threading.Tasks.Task

OnShutdown()

Called if the app is being brought down.

View Source
Declaration
Task OnShutdown()
Returns

System.Threading.Tasks.Task

OnError(Exception)

Called if a failure occurred while running the app

View Source
Declaration
Task OnError(Exception e)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Exceptione

OnUpdate(Version, out bool)

Called when the application is about to update itself.

View Source
Declaration
void OnUpdate(Version newVersion, out bool approveUpdate)
Parameters
TypeName
System.VersionnewVersion
System.BooleanapproveUpdate

OnUpdateComplete(Version, out bool)

Called when the application has updated itself.

View Source
Declaration
void OnUpdateComplete(Version oldVersion, out bool rollbackUpdate)
Parameters
TypeName
System.VersionoldVersion
System.BooleanrollbackUpdate