Properties
AlternateModifier
#Gets the alternate modifier for shortcuts.
Remarks: This is usually the Keys.Alt key.
Value: The alternate modifier.
BadgeLabel
#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.
Value: The badge label.
CommonModifier
#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).
Value: The common modifier.
Remarks: Some platforms may use this to identify controls (e.g. web)
NativeHandle
nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
Value: The native handle.
QuitIsSupported
#Gets a value indicating whether the application supports the Quit() operation.
Value:
true if quit is supported; otherwise, false.Gets or sets the current visual theme of the application.
Methods
AsyncInvoke
#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.
Parameters:
| action (Action) | Action to queue on the UI thread. |
Attach
#Attach the application to an already-running native application with the same platform.
Parameters:
| context (object) | Context of the application |
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.
Initialize
void Initialize()
Called after the widget is constructed
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
#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.
Parameters:
| action (Action) | Action to invoke |
OnMainFormChanged
#void OnMainFormChanged()
Called by the widget when the Application.MainForm is changed
Open
#Open the specified file or url with its associated application.
Parameters:
| url (string) | url or file path to open |
Quit
#void Quit()
Quits the application
Remarks: This should call the Application.ICallback.OnTerminating(Application, CancelEventArgs) callback to allow user-defined code to cancel the operation.
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
Called when the last subscriber to an event has been removed, so the platform can stop listening for it.
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.
Parameters:
| id (string) | ID of the event to stop handling |