当前位置: 首页>>代码示例>>C#>>正文


C# IAsyncToken.Dispose方法代码示例

本文整理汇总了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));
     }
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:11,代码来源:TestForegroundNotificationService.cs

示例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);
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:16,代码来源:TestForegroundNotificationService.cs

示例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);
            }
开发者ID:Rickinio,项目名称:roslyn,代码行数:18,代码来源:NavigateToItemProvider.Searcher.cs


注:本文中的IAsyncToken.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。