本文整理匯總了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));
};
}
示例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;
};
}
示例3: Complete
private Action<bool> Complete(Dispatcher dispatcher, ResourceModel model)
{
return result =>
{
dispatcher.Handle(async () =>
{
model.Complete(result);
await this.Persist();
});
};
}
示例4: SetEstimation
private Action<TimeSpan> SetEstimation(Dispatcher dispatcher, ResourceModel model)
{
return estimation =>
{
dispatcher.Handle(() => model.SetEstimation(estimation));
};
}
示例5: SetSpeed
private Action<long> SetSpeed(Dispatcher dispatcher, ResourceModel model)
{
return speed =>
{
dispatcher.Handle(() => model.SetSpeed(speed));
};
}
示例6: SetProgress
private Action<long, long> SetProgress(Dispatcher dispatcher, ResourceModel model)
{
return (received, total) =>
{
dispatcher.Handle(() => model.SetProgress(received, total));
};
}
示例7: SetStatus
private Action<string> SetStatus(Dispatcher dispatcher, ResourceModel model)
{
return status =>
{
dispatcher.Handle(() => model.SetStatus(status));
};
}