GetDispatcher Method

DynamicRenderer.GetDispatcher Method ()

 

Returns a Dispatcher for the rendering thread.

Namespace:   System.Windows.Input.StylusPlugIns
Assembly:  PresentationCore (in PresentationCore.dll)

Protected Function GetDispatcher As Dispatcher

Return Value

Type: System.Windows.Threading.Dispatcher

A Dispatcher for the rendering thread.

The following example demonstrates how to use the GetDispatcher method to perform some work on the rendering thread.

Delegate Sub WorkerMethod()

Class CustomDynamicRenderer
    Inherits DynamicRenderer

    Protected Overrides Sub OnStylusDown(ByVal rawStylusInput As RawStylusInput)

        MyBase.OnStylusDown(rawStylusInput)
        rawStylusInput.NotifyWhenProcessed(Nothing)

    End Sub 'OnStylusDown


    Protected Overrides Sub OnStylusDownProcessed(ByVal callbackData As Object, ByVal targetVerified As Boolean)

        MyBase.OnStylusDownProcessed(callbackData, targetVerified)

        Dim renderingThreadDispatcher As Dispatcher = Me.GetDispatcher()
        renderingThreadDispatcher.BeginInvoke(DispatcherPriority.Normal, New WorkerMethod(AddressOf DoSomething))

    End Sub 'OnStylusDownProcessed


    Private Sub DoSomething()
        ' Perform work on the rendering thread.
    End Sub 'DoSomething

End Class

.NET Framework
Available since 3.0
Return to top
Show:
© 2016 Microsoft