本文整理汇总了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));
};
}