Application.IHandler

References
[AutoInitialize(false)] public interface Application.IHandler : Widget.IHandler
Handler interface for the Application class

Properties

AlternateModifier

#
Keys AlternateModifier { get; }
Gets the alternate modifier for shortcuts.

BadgeLabel

#
string BadgeLabel { get; set; }
Gets or sets the badge label on the application icon in the dock, taskbar, etc.
Remarks: This allows you to specify the text to show as a label to notify the state of your application to the user. Note that some platforms (iOS) only support numeric badge labels.
The badge label.

CommonModifier

#
Keys CommonModifier { get; }
Gets the common modifier for shortcuts.
Remarks: On Windows/Linux, this will typically return Keys.Control, and on OS X this will be Keys.Application (the command key).
The common modifier.

ID

string ID { get; set; }
Gets or sets an ID for the widget
inherited fromWidget.IHandler
Remarks: Some platforms may use this to identify controls (e.g. web)

IsActive

#
bool IsActive { get; }
Gets a value indicating that the application is currently the active application

NativeHandle

nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
inherited fromWidget.IHandler

QuitIsSupported

#
bool QuitIsSupported { get; }
Gets a value indicating whether the application supports the Quit() operation.

Theme

#Since v2.12
Theme Theme { get; set; }
Gets or sets the current visual theme of the application.

Methods

AsyncInvoke

#
void AsyncInvoke(Action action)
Invoke the action asynchronously on the UI thread
Remarks: This will return immediately and queue the action to be executed on the UI thread, regardless on whether the current thread is the UI thread.
action (Action)Action to queue on the UI thread.

Attach

#
void Attach(object context)
Attach the application to an already-running native application with the same platform.

HandleEvent

void HandleEvent(string id, bool defaultEvent = false)
Called to handle a specific event
inherited fromWidget.IHandler
Remarks: Most events are late bound by this method. Instead of wiring all events, this will be called with an event string that is defined by the control. This is called automatically when attaching to events, but must be called manually when users of the control only override the event's On... method.
id (string)ID of the event to handle
defaultEvent (bool = false)True if the event is default (e.g. overridden or via an event handler subscription)

Initialize

void Initialize()
Called after the widget is constructed
inherited fromWidget.IHandler
Remarks: This gets called automatically after the control is constructed and the Widget.IHandler.Widget and Widget.Platform properties are set. When the handler has specialized construction methods, then the AutoInitializeAttribute can be used to disable automatic initialization. In this case, it is the responsibility of the subclass to call Widget.Initialize()

Invoke

#
void Invoke(Action action)
Invoke the specified action on the UI thread, blocking the current execution until it is complete.
Remarks: Implementors should be careful to execute the action directly if the current thread is the UI thread.
action (Action)Action to invoke

Open

#
void Open(string url)
Open the specified file or url with its associated application.

Quit

#
void Quit()
Quits the application

RunIteration

#
void RunIteration()
Advanced. Runs an iteration of the main UI loop when you are blocking the UI thread with logic.
Remarks: This is not recommended to use and you should use asynchronous calls instead via Task.Run or threads.

UnhandleEvent

virtual void UnhandleEvent(string id)
Called when the last subscriber to an event has been removed, so the platform can stop listening for it.
inherited fromWidget.IHandler
Remarks: Only reached for events whose remove accessor uses PropertyStore.RemoveHandlerEvent(string, Delegate), and only for events that were attached because something subscribed to them. An event attached because the widget overrides its On[Event] method is never detached, since it has to keep firing regardless. Most events stay attached for the life of the widget, which costs nothing. Detaching is worth wiring up for the few that hold onto something expensive or process wide while they are attached, such as a system wide hook. Handlers deriving from WidgetHandler<TWidget> get an implementation of this that dispatches to WidgetHandler<TWidget>.DetachEvent(string), which is what to override.
id (string)ID of the event to stop handling