Class Dispatcher
Implements thread dispatcher, which is responsible for thread safety
Inheritance
System.Object
Dispatcher
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: EmptyKeys.UserInterface.Threading
Assembly: EmptyKeys.UserInterface.dll
Syntax
public sealed class Dispatcher
Properties
EnableExceptionOnMultithreadAccess
Enables exception if another thread access UI
Declaration
public static bool EnableExceptionOnMultithreadAccess { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Thread
Gets the thread of the dispatcher
Declaration
public Thread Thread { get; }
Property Value
Type | Description |
---|---|
System.Threading.Thread |
Methods
AddDispatcher(Dispatcher)
Adds new dispatcher to the collection;
Declaration
public static void AddDispatcher(Dispatcher dispatcher)
Parameters
Type | Name | Description |
---|---|---|
Dispatcher | dispatcher | the dispatcher to be added |
BeginInvoke(Action)
Executes the specified action asynchronously
Declaration
public DispatcherOperation BeginInvoke(Action action)
Parameters
Type | Name | Description |
---|---|---|
System.Action | action | the operation action |
Returns
Type | Description |
---|---|
DispatcherOperation | Dispatcher operation for the specified action |
GetCurrentDispatcher()
Gets current dispatcher for the current thread
Declaration
public static Dispatcher GetCurrentDispatcher()
Returns
Type | Description |
---|---|
Dispatcher | New dispatcher or existing dispatcher for the thread |
HasAccess()
Checks if the thread and current thread is the same
Declaration
public bool HasAccess()
Returns
Type | Description |
---|---|
System.Boolean | True if threads are the same |
Invoke(Action)
Invokes action on the thread of dispatcher or adds action to queue
Declaration
public void Invoke(Action action)
Parameters
Type | Name | Description |
---|---|---|
System.Action | action | the action to execute |
ProcessQueue()
Processes all operations in dispatcher action queue
Declaration
public void ProcessQueue()
VerifyAccess()
Verifies if current thread has access to this dispatcher
Declaration
public void VerifyAccess()