本文整理汇总了C#中IAsyncToken.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# IAsyncToken.Dispose方法的具体用法?C# IAsyncToken.Dispose怎么用?C# IAsyncToken.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAsyncToken
的用法示例。
在下文中一共展示了IAsyncToken.Dispose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute_NoLock
private void Execute_NoLock(Func<bool> action, IAsyncToken asyncToken, CancellationToken cancellationToken)
{
if (action())
{
asyncToken.Dispose();
}
else
{
_tasks.Add(_queue.ScheduleTask(() => Execute_NoLock(action, asyncToken, cancellationToken), cancellationToken));
}
}
示例2: RegisterNotification
public void RegisterNotification(Action action, int delayInMS, IAsyncToken asyncToken, CancellationToken cancellationToken = default(CancellationToken))
{
Task task;
lock (_gate)
{
task = _queue.ScheduleTask(() =>
{
action();
asyncToken.Dispose();
}, cancellationToken);
_tasks.Add(task);
}
task.Wait(cancellationToken);
}
示例3: Search
private void Search(IDisposable navigateToSearch, IAsyncToken asyncToken)
{
var searchTasks = _solution.Projects.Select(SearchAsync).ToArray();
var whenAllTask = Task.WhenAll(searchTasks);
// NOTE(cyrusn) This SafeContinueWith is *not* cancellable. We must dispose of the notifier
// in order for tests to work property. Also, if we don't notify the callback that we're
// done then the UI will never stop displaying the progress bar.
whenAllTask.SafeContinueWith(_ =>
{
_callback.Done();
navigateToSearch.Dispose();
asyncToken.Dispose();
},
CancellationToken.None,
TaskContinuationOptions.ExecuteSynchronously,
TaskScheduler.Default);
}