Class EtoFormDispatcher<T>
Lazily creates a Eto.Forms.Form on the Eto.Forms UI thread and marshals interactions onto it.
public sealed class EtoFormDispatcher<T> : IDisposable where T : Form
Type Parameters
TThe type of the form to wrap.
- Inheritance
-
objectEtoFormDispatcher<T>
- Implements
- Extension Methods
Remarks
This does not start a separate message loop. Eto.Forms runs a single Eto.Forms.Application on the main thread, so all interactions are marshaled onto that thread via Invoke(Action) and AsyncInvoke(Action). A running Eto.Forms.Application is therefore a precondition for using this class.
Constructors
EtoFormDispatcher(Func<T>)
Creates a new asynchronous form wrapper.
public EtoFormDispatcher(Func<T> init)
Parameters
initFunc<T>Callback that creates an instance of the form. Invoked on the UI thread on first access.
Methods
Close()
Closes the Eto.Forms.Form.
public void Close()
Remarks
Does nothing if the Eto.Forms.Form was not yet created or is already closed.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Post(Action<T>)
Executes an action on the UI thread, waiting for it to complete.
public void Post(Action<T> action)
Parameters
actionAction<T>The action to execute; gets passed the
Tinstance.
Exceptions
- OperationCanceledException
The form was closed.
Post<TResult>(Func<T, TResult>)
Executes a function on the UI thread, waiting for it to complete.
public TResult Post<TResult>(Func<T, TResult> action)
Parameters
actionFunc<T, TResult>A delegate that is passed the
Tinstance and returns a result.
Returns
- TResult
The result returned by
action.
Type Parameters
TResultThe type of the result returned by
action.
Exceptions
- OperationCanceledException
The form was closed.
Send(Action<T>)
Executes an action on the UI thread without waiting for it to complete.
public void Send(Action<T> action)
Parameters
actionAction<T>The action to execute; gets passed the
Tinstance.
Exceptions
- OperationCanceledException
The form was closed.
SendLow(Action<T>)
Executes an action on the UI thread without waiting for it to complete.
public void SendLow(Action<T> action)
Parameters
actionAction<T>The action to execute; gets passed the
Tinstance.
Remarks
Does nothing if the Eto.Forms.Form was not yet created or is already closed.