當前位置: 首頁>>代碼示例>>C#>>正文


C# Dispatcher.Handle方法代碼示例

本文整理匯總了C#中System.Windows.Threading.Dispatcher.Handle方法的典型用法代碼示例。如果您正苦於以下問題:C# Dispatcher.Handle方法的具體用法?C# Dispatcher.Handle怎麽用?C# Dispatcher.Handle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Threading.Dispatcher的用法示例。


在下文中一共展示了Dispatcher.Handle方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Log

 private Action<LogEntry> Log(Dispatcher dispatcher)
 {
     return entry =>
     {
         dispatcher.Handle(() => this.OnLog.Invoke(entry));
     };
 }
開發者ID:amacal,項目名稱:ine,代碼行數:7,代碼來源:TransferControl.xaml.cs

示例2: GetSolver

        private Func<Captcha, Task<string>> GetSolver(Dispatcher dispatcher)
        {
            return captcha =>
            {
                TaskCompletionSource<string> completion = new TaskCompletionSource<string>();

                dispatcher.Handle(async () =>
                {
                    string solution = await this.OnCaptcha.Invoke(captcha);
                    if (String.IsNullOrWhiteSpace(solution) == false)
                    {
                        completion.SetResult(solution);
                    }
                    else
                    {
                        completion.TrySetCanceled(captcha.Cancellation);
                    }
                });

                return completion.Task;
            };
        }
開發者ID:amacal,項目名稱:ine,代碼行數:22,代碼來源:TransferControl.xaml.cs

示例3: Complete

 private Action<bool> Complete(Dispatcher dispatcher, ResourceModel model)
 {
     return result =>
     {
         dispatcher.Handle(async () =>
         {
             model.Complete(result);
             await this.Persist();
         });
     };
 }
開發者ID:amacal,項目名稱:ine,代碼行數:11,代碼來源:TransferControl.xaml.cs

示例4: SetEstimation

 private Action<TimeSpan> SetEstimation(Dispatcher dispatcher, ResourceModel model)
 {
     return estimation =>
     {
         dispatcher.Handle(() => model.SetEstimation(estimation));
     };
 }
開發者ID:amacal,項目名稱:ine,代碼行數:7,代碼來源:TransferControl.xaml.cs

示例5: SetSpeed

 private Action<long> SetSpeed(Dispatcher dispatcher, ResourceModel model)
 {
     return speed =>
     {
         dispatcher.Handle(() => model.SetSpeed(speed));
     };
 }
開發者ID:amacal,項目名稱:ine,代碼行數:7,代碼來源:TransferControl.xaml.cs

示例6: SetProgress

 private Action<long, long> SetProgress(Dispatcher dispatcher, ResourceModel model)
 {
     return (received, total) =>
     {
         dispatcher.Handle(() => model.SetProgress(received, total));
     };
 }
開發者ID:amacal,項目名稱:ine,代碼行數:7,代碼來源:TransferControl.xaml.cs

示例7: SetStatus

 private Action<string> SetStatus(Dispatcher dispatcher, ResourceModel model)
 {
     return status =>
     {
         dispatcher.Handle(() => model.SetStatus(status));
     };
 }
開發者ID:amacal,項目名稱:ine,代碼行數:7,代碼來源:TransferControl.xaml.cs


注:本文中的System.Windows.Threading.Dispatcher.Handle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。