DynamicRenderer.GetDispatcher Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a Dispatcher for the rendering thread.
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
Returns
A Dispatcher for the rendering thread.
Examples
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.
}
}
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
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET