次の方法で共有


DynamicRenderer.GetDispatcher メソッド

定義

レンダリング スレッドの Dispatcher を返します。

protected:
 System::Windows::Threading::Dispatcher ^ GetDispatcher();
protected System.Windows.Threading.Dispatcher GetDispatcher ();
member this.GetDispatcher : unit -> System.Windows.Threading.Dispatcher
Protected Function GetDispatcher () As Dispatcher

戻り値

レンダリング スレッドの Dispatcher

次の例では、 メソッドを使用 GetDispatcher してレンダリング スレッドで何らかの作業を実行する方法を示します。

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.
    }
}
Delegate Sub WorkerMethod()

Class CustomDynamicRenderer
    Inherits DynamicRenderer

    Protected Overrides Sub OnStylusDown(ByVal rawStylusInput As RawStylusInput)

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

    End Sub


    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


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

End Class

適用対象