Exemple #1
0
        /// <summary>
        /// Schedules the provided handler on the dispatcher.
        /// </summary>
        /// <param name="priority">The execution priority for the handler</param>
        /// <param name="handler">The handler to execute</param>
        /// <returns>An async operation for the scheduled handler.</returns>
        public UIAsyncOperation RunAsync(CoreDispatcherPriority priority, CancellableDispatchedHandler handler)
        {
            UIAsyncOperation operation = null;

            DispatchedHandler nonCancellableHandler = () => handler(operation.Token);

            return(operation = EnqueueOperation(priority, nonCancellableHandler));
        }
Exemple #2
0
        /// <summary>
        /// Schedules the provided handler on the dispatcher.
        /// </summary>
        /// <param name="priority">The execution priority for the handler</param>
        /// <param name="handler">The handler to execute</param>
        /// <returns>An async operation for the scheduled handler.</returns>
        /// <remarks>Can only be invoked on the UI thread</remarks>
        internal UIAsyncOperation RunAsync(CoreDispatcherPriority priority, CancellableDispatchedHandler handler)
        {
            CoreDispatcher.CheckThreadAccess();

            UIAsyncOperation operation = null;

            DispatchedHandler nonCancellableHandler = () => handler(operation.Token);

            return(operation = EnqueueOperation(priority, nonCancellableHandler));
        }