Class AppBase
Provides a base implementation for the Meadow App. Use this class for Meadow applications to get strongly-typed access to the current device information.
Assembly: Meadow.dll
View Source
public abstract class AppBase : IApp
Derived:
Meadow.App<D>
Implements:
Meadow.IApp
Properties
CancellationToken
A cancellation token that is canceled when the application is signaled to shut down
View Source
public CancellationToken CancellationToken { get; }
Settings
Settings parsed from the app.config.yaml at startup
View Source
public Dictionary<string, string> Settings { get; }
Abort
The app cancellation token
View Source
public static CancellationToken Abort { get; protected set; }
Methods
InvokeOnMainThread(Action<object?>, object?)
Invokes an action in the context of the applications main thread
View Source
public virtual void InvokeOnMainThread(Action<object?> action, object? state = null)
Parameters
Type | Name | Description |
---|---|---|
System.Action<System.Object> | action | The action to call |
System.Object | state | An optional state object to pass to the Action |
Run()
Called by MeadowOS when everything is ready for the App to run
View Source
public virtual Task Run()
Returns
System.Threading.Tasks.Task
Initialize()
Called by MeadowOS to initialize the App
View Source
public virtual Task Initialize()
Returns
System.Threading.Tasks.Task
OnShutdown()
Called when a request to shut down the App occurs
View Source
public virtual Task OnShutdown()
Returns
System.Threading.Tasks.Task
OnError(Exception)
Called when the MeadowOS encounters an error
View Source
public virtual Task OnError(Exception e)
Returns
System.Threading.Tasks.Task
Parameters
Type | Name | Description |
---|---|---|
System.Exception | e | The exception from MeadowOS |
OnUpdate(Version, out bool)
Called when the application is about to update itself.
View Source
public 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
public void OnUpdateComplete(Version oldVersion, out bool rollbackUpdate)
Parameters
Type | Name |
---|---|
System.Version | oldVersion |
System.Boolean | rollbackUpdate |
DisposeAsync()
Virtual method provided for App implementations to clean up resources on Disposal
View Source
public virtual ValueTask DisposeAsync()
Returns
System.Threading.Tasks.ValueTask