WpfHelper.DispatcherShutdowner Struct
Represents the Dispatcher instance associated with the current thread and provides a means to shut it down if it was IsDispatcherNewlyCreated before the current thread terminates, thus preventing the resource leak.
public readonly struct DispatcherShutdowner : IDisposable
Public Structure DispatcherShutdowner
Implements IDisposable
Implements
Properties
IsDispatcherNewlyCreated
Gets a value indicating whether a Dispatcher instance associated with the current thread was created with the CreateDispatcherForCurrentThread() method call or it already existed before.
public readonly bool IsDispatcherNewlyCreated { get; }
Public ReadOnly Property IsDispatcherNewlyCreated As Boolean
Property Value
- System.Boolean
true if a Dispatcher instance associated with the current thread was created with the CreateDispatcherForCurrentThread() method call; otherwise, false if it already existed before.
Remarks
The Dispose() method will shutdown the Dispatcher instance associated with the current thread only if the value of this property is true.
IsDispatcherShutdown
Gets a value indicating a Dispatcher instance associated with the current thread is already shutdown.
public readonly bool IsDispatcherShutdown { get; }
Public ReadOnly Property IsDispatcherShutdown As Boolean
Property Value
- System.Boolean
true if a Dispatcher instance associated with the current thread is already shutdown; otherwise, false.
Remarks
If the value of this property is false then GemBox will use or consider using WPF in the current thread; otherwise, if the value is true, GemBox won't use WPF in the current thread because its Dispatcher is already shutdown.
Methods
Dispose()
Shuts down the Dispatcher instance associated with the current thread if it was IsDispatcherNewlyCreated.
Remarks
This method must be called in the same thread in which the CreateDispatcherForCurrentThread() method was called.
Exceptions
- System.InvalidOperationException
The call was not made in the same thread in which the CreateDispatcherForCurrentThread() method was called.