GemBox.Presentation
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    WpfHelper.DispatcherShutdowner Struct

    Namespace:
    GemBox.Presentation
    Assembly:
    GemBox.Presentation.dll

    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.

    • C#
    • VB.NET
    public readonly struct DispatcherShutdowner : IDisposable
    Public Structure DispatcherShutdowner
        Implements IDisposable
    Implements
    System.IDisposable

    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.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    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.

    • C#
    • VB.NET
    public readonly void Dispose()
    Public Sub Dispose
    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.

    Implements

    System.IDisposable
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.