Dispatcher. Run Idle Async(IdleDispatchedHandler) Method
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.
Schedules a callback on the UI thread from a worker thread at idle priority, and returns the results asynchronously.
public: virtual IAsyncAction ^ RunIdleAsync(IdleDispatchedHandler ^ agileCallback) = RunIdleAsync;
/// [Windows.Foundation.Metadata.RemoteAsync] IAsyncAction RunIdleAsync(IdleDispatchedHandler const& agileCallback);
[Windows.Foundation.Metadata.RemoteAsync] public IAsyncAction RunIdleAsync(IdleDispatchedHandler agileCallback);
Public Function RunIdleAsync (agileCallback As IdleDispatchedHandler) As IAsyncAction
The callback on which the idle priority dispatcher returns when the event is dispatched.
Object that contains the results of the asynchronous action.
The RunIdleAsync method is very similar to CoreDispatcher.RunAsync, except that it always schedules the work item at CoreDispatcherPriority.Low priority. When you schedule a work item by calling RunIdleAsync from a worker thread, the work item is processed only when there are no event messages pending in the queue. This allows your app to perform tasks such as spell check or other discrete processing while the system is idle. If the IdleDispatchedHandler delegate returned by the callback has the IsDispatcherIdle property set to false, the work item immediately exits background processing until the event queue is empty again.
However, while your app is processing a background task, it can continue processing as long as there are no event messages pending in the CoreDispatcher event message queue. If your app receives an event message in the queue, then it must break out of the background processing. To determine when your app must exit background processing, access the IsDispatcherIdle property on the IdleDispatchedHandlerArgs object returned by the IdleDispatchedHandler callback you provided to RunIdleAsync. If there is a message, exit background processing and set the priority to CoreDispatcherPriority.Normal. Otherwise, if the callback continues to run without checking the dispatcher status, it could lead to input starvation.
Submit and view feedback for