DynamicRenderer.GetDispatcher Method ()

 

Returns a Dispatcher for the rendering thread.

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

protected Dispatcher GetDispatcher()

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 void WorkerMethod();

class CustomDynamicRenderer : DynamicRenderer
{
    protected override void OnStylusDown(RawStylusInput rawStylusInput)
    {
        base.OnStylusDown(rawStylusInput);
        rawStylusInput.NotifyWhenProcessed(null);

    }

    protected override void OnStylusDownProcessed(object callbackData, bool targetVerified)
    {
        base.OnStylusDownProcessed(callbackData, targetVerified);

        Dispatcher renderingThreadDispatcher = this.GetDispatcher();
        renderingThreadDispatcher.BeginInvoke(DispatcherPriority.Normal, new WorkerMethod(DoSomething));
    }

    private void DoSomething()
    {
        // Perform work on the rendering thread.
    }
}

.NET Framework
Available since 3.0
Return to top
Show: