Characteristic | Locus |
---|---|
Inheritance | object > App<D> |
Implements | IApp IAsyncDisposable |
Inherited Members | object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() |
Namespace | Meadow |
Assembly | Meadow.dll |
Syntax
public abstract class App<D> : IApp, IAsyncDisposable where D : class, IMeadowDevice
Type Parameters
Name | Description |
---|---|
D |
Constructors
App()
Base constructor for the App class
Declaration
protected App()
Properties
Abort
The app cancellation token
Declaration
public static CancellationToken Abort { get; protected set; }
Property Value
Type | Description |
---|---|
CancellationToken |
CancellationToken
A cancellation token that is canceled when the application is signaled to shut down
Declaration
public CancellationToken CancellationToken { get; }
Property Value
Type | Description |
---|---|
CancellationToken |
Device
The root Device interface
Declaration
public static D Device { get; protected set; }
Property Value
Type | Description |
---|---|
D |
Settings
Settings parsed from the app.config.yaml at startup
Declaration
public Dictionary<string, string> Settings { get; }
Property Value
Type | Description |
---|---|
Dictionary<string, string> |
Methods
DisposeAsync()
Virtual method provided for App implementations to clean up resources on Disposal
Declaration
public virtual ValueTask DisposeAsync()
Returns
Type | Description |
---|---|
ValueTask |
Initialize()
Called by MeadowOS to initialize the App
Declaration
public virtual Task Initialize()
Returns
Type | Description |
---|---|
Task |
InvokeOnMainThread(Action<object?>, object?)
Invokes an action in the context of the applications main thread
Declaration
public void InvokeOnMainThread(Action<object?> action, object? state = null)
Parameters
Type | Name | Description |
---|---|---|
Action<object> | action | The action to call |
object | state | An optional state object to pass to the Action |
OnError(Exception)
Called when the MeadowOS encounters an error
Declaration
public virtual Task OnError(Exception e)
Parameters
Type | Name | Description |
---|---|---|
Exception | e | The exception from MeadowOS |
Returns
Type | Description |
---|---|
Task |
OnShutdown()
Called when a request to shut down the App occurs
Declaration
public virtual Task OnShutdown()
Returns
Type | Description |
---|---|
Task |
Remarks
This is called by the Update Service before applying an update
OnUpdate(Version, out bool)
Called when the application is about to update itself.
Declaration
public void OnUpdate(Version newVersion, out bool approveUpdate)
Parameters
Type | Name | Description |
---|---|---|
Version | newVersion | |
bool | approveUpdate |
OnUpdateComplete(Version, out bool)
Called when the application has updated itself.
Declaration
public void OnUpdateComplete(Version oldVersion, out bool rollbackUpdate)
Parameters
Type | Name | Description |
---|---|---|
Version | oldVersion | |
bool | rollbackUpdate |
Run()
Called by MeadowOS when everything is ready for the App to run
Declaration
public virtual Task Run()
Returns
Type | Description |
---|---|
Task |