Language

DispatcherExtensions.WithPriority Method

Definition

Creates a JoinableTaskFactory that schedules work with the specified Dispatcher and DispatcherPriority.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::VisualStudio::Threading::JoinableTaskFactory ^ WithPriority(Microsoft::VisualStudio::Threading::JoinableTaskFactory ^ joinableTaskFactory, System::Windows::Threading::Dispatcher ^ dispatcher, System::Windows::Threading::DispatcherPriority priority);
public static Microsoft.VisualStudio.Threading.JoinableTaskFactory WithPriority(this Microsoft.VisualStudio.Threading.JoinableTaskFactory joinableTaskFactory, System.Windows.Threading.Dispatcher dispatcher, System.Windows.Threading.DispatcherPriority priority);
static member WithPriority : Microsoft.VisualStudio.Threading.JoinableTaskFactory * System.Windows.Threading.Dispatcher * System.Windows.Threading.DispatcherPriority -> Microsoft.VisualStudio.Threading.JoinableTaskFactory
<Extension()>
Public Function WithPriority (joinableTaskFactory As JoinableTaskFactory, dispatcher As Dispatcher, priority As DispatcherPriority) As JoinableTaskFactory

Parameters

joinableTaskFactory
JoinableTaskFactory

The underlying JoinableTaskFactory to use.

dispatcher
Dispatcher

The Dispatcher that schedules work on the main thread.

priority
DispatcherPriority

The priority with which to schedule any work on the UI thread, when and if SwitchToMainThreadAsync(CancellationToken) is called and for each asynchronous return to the main thread after an await.

Returns

A JoinableTaskFactory that may be used for scheduling async work with the specified priority.

Remarks

In addition to scheduling work on the UI thread with the specified priority, this JoinableTaskFactory also ensures that any synchronous waits on the main thread within JoinableTask objects created with the returned factory will honor calls to DisableProcessing(), producing similar behavior to DisableProcessing().

Applies to