static void Main() { var pts = new PauseTokenSource(); var task = SomeMethodAsync(pts.Token); Task.Run(() => { Console.WriteLine("Before pause requested"); pts.PauseWithResponseAsync().Wait(); Console.WriteLine("After pause requested."); pts.Resume(); }).Wait(); Console.ReadLine(); // Alternatively, async version: /* * Func<Task> func = async () => * { * Console.WriteLine("Before pause requested"); * await pts.PauseWithResponseAsync(); * Console.WriteLine("After pause requested."); * pts.Resume(); * }; * func().Wait(); * Console.ReadLine(); */ }
// Testing static async Task Test() { var pts = new PauseTokenSource(); var task = SomeMethodAsync(pts.Token); // sync version Console.WriteLine("Before pause requested"); pts.PauseWithResponseAsync().Wait(); Console.WriteLine("After pause requested, paused: " + pts.Token.IsPaused); pts.PauseWithResponseAsync().Wait(); Console.WriteLine("After pause requested, paused: " + pts.Token.IsPaused); Console.WriteLine("Press enter to resume..."); Console.ReadLine(); pts.Resume(); // async version: Console.WriteLine("Before pause requested"); await pts.PauseWithResponseAsync(); Console.WriteLine("After pause requested, paused: " + pts.Token.IsPaused); await pts.PauseWithResponseAsync(); Console.WriteLine("After pause requested, paused: " + pts.Token.IsPaused); Console.WriteLine("Press enter to resume..."); Console.ReadLine(); pts.Resume(); }
static async Task Test(CancellationToken token) { var pts = new PauseTokenSource(); var task = DoWorkAsync(pts.Token, token); while (true) { token.ThrowIfCancellationRequested(); Console.WriteLine("Press enter to pause..."); Console.ReadLine(); Console.WriteLine("Before pause requested"); await pts.PauseAsync(); Console.WriteLine("After pause requested, paused: " + await pts.IsPaused()); Console.WriteLine("Press enter to resume..."); Console.ReadLine(); Console.WriteLine("Before resume"); await pts.ResumeAsync(); Console.WriteLine("After resume"); } }
private async Task Crawl() { CancellationTokenSource cancellation = new CancellationTokenSource(); PauseTokenSource pause = new PauseTokenSource(); crawlerCancellationToken = cancellation; crawlerPauseToken = pause; crawlerService.IsCrawl = true; crawlCommand.RaiseCanExecuteChanged(); pauseCommand.RaiseCanExecuteChanged(); stopCommand.RaiseCanExecuteChanged(); await crawlerService.DatabasesLoaded.Task; for (int i = 0; i < shellService.Settings.ConcurrentBlogs; i++) { runningTasks.Add(Task.Run(() => RunCrawlerTasks(cancellation.Token, pause.Token))); } try { await Task.WhenAll(runningTasks.ToArray()); crawlerCancellationToken.Dispose(); } catch { } finally { runningTasks.Clear(); } }
public async Task StartSyncProcess() { if (_pauseTokenSource?.IsPaused ?? false) { await ResumeAsync(); return; } var run = true; if (!ChargerAndNetworkAvailable()) { run = await GetWarningDialogResultAsync(); } if (run) { await Task.Factory.StartNew(async() => { _executionSession = await RequestExtendedExecutionAsync(); _pauseTokenSource = new PauseTokenSource(); DisplayRequest displayRequest = null; try { await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => { displayRequest = new DisplayRequest(); displayRequest.RequestActive(); }); _Initialize(); await _worker.Run(_pauseTokenSource); } catch (Exception e) { if (Windows.ApplicationModel.Core.CoreApplication.Views.Count > 0) { await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { ExecutionContext.Instance.Status = ExecutionStatus.Error; }); } await LogHelper.Write(e.Message); await LogHelper.Write(e.StackTrace); } finally { await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => { displayRequest?.RequestRelease(); ExecutionContext.Instance.IsPaused = false; }); ClearExecutionSession(_executionSession); } }); } }
protected SuspendableFileWorker(IBytesBuffer buffer, IFile fileWrapper, CancellationTokenSource cancellationTokenSource) { Buffer = buffer; CancellationTokenSource = cancellationTokenSource; FileWrapper = fileWrapper; PauseTokenSource = new PauseTokenSource(); _currentStateObs = new BehaviorSubject <WorkerState>(WorkerState.Unstarted); _result = new AsyncSubject <ResultDto>(); }
private void btnStartAsync_Click(object sender, EventArgs e) { _pauseTokeSource = new PauseTokenSource(); _cancelToken = default(CancellationToken); _pauseTokeSource.onPause -= _pauseTokeSource_onPause; _pauseTokeSource.onPause += _pauseTokeSource_onPause; Task t = new Task(() => { LongRunning(_pauseTokeSource); }, _cancelToken); t.Start(); }
public void Reset() { _sync = SynchronizationContext.Current; _cts = new CancellationTokenSource(); CancellationToken = _cts.Token; _pts = new PauseTokenSource(); PauseToken = _pts.Token; Progress = 0f; IsProcessing = false; }
public MainForm() { InitializeComponent(); loading = false; myPause = new PauseTokenSource(); myCancel = new CancellationTokenSource(); EnableForm(true); cancelled = true; if (File.Exists("savingproperties.dat")) { LoadData(); } }
static void Main() { var pts = new PauseTokenSource(); Task.Run(() => { while (true) { Console.ReadLine(); pts.IsPaused = !pts.IsPaused; } }); SomeMethodAsync(pts.Token).Wait(); }
private async void LongRunning(PauseTokenSource pause) { _updateGUI = new updateUI(SetUI); for (int i = 0; i < 20; i++) { await pause.WaitWhilePausedAsync(); Thread.Sleep(500); this.Invoke(_updateGUI, i.ToString() + " => " + txtInput.Text); //txtOutput.AppendText(Environment.NewLine + i.ToString()); if (_cancelToken.IsCancellationRequested) { this.Invoke(_updateGUI, "Task cancellation requested at " + DateTime.Now.ToString()); break; } } _updateGUI = null; }
private async Task SetupCrawlAsync() { _crawlerCancellationTokenSource = new CancellationTokenSource(); _crawlerPauseTokenSource = new PauseTokenSource(); _crawlerService.IsCrawl = true; _crawlCommand.RaiseCanExecuteChanged(); _pauseCommand.RaiseCanExecuteChanged(); _stopCommand.RaiseCanExecuteChanged(); await Task.WhenAll(_crawlerService.LibraryLoaded.Task, _crawlerService.DatabasesLoaded.Task); for (var i = 0; i < _shellService.Settings.ConcurrentBlogs; i++) { _runningTasks.Add(Task.Run(() => RunCrawlerTasksAsync(_crawlerPauseTokenSource.Token, _crawlerCancellationTokenSource.Token))); } await CrawlAsync(); }
public async Task Usage1() { using (var crawler = new Crawler()) { var job = new JobDTO { }; var cancellationTokenSource = new CancellationTokenSource(); var pauseTokenSource = new PauseTokenSource(); var progressToken = new ProgressToken(); var crawlTask = crawler.Start(job, cancellationTokenSource.Token, pauseTokenSource.Token, progressToken); while (!crawlTask.IsCompleted && !crawlTask.IsCanceled) { } var result = await crawlTask; } }
// ReSharper disable once NotNullMemberIsNotInitialized - CorrespondingCollection can't be initialized here because it doesn't exist yet private FolderCollection(Func <bool> isDesiredThread, PauseTokenSource pauseTokenSource) { PauseTokenSource = pauseTokenSource; if (PauseTokenSource != null) { PauseToken = pauseTokenSource.Token; } Folders = new AsyncObservableKeyedSet <string, GameFolder>(folder => folder.Name, isDesiredThread, comparer: StringComparer.OrdinalIgnoreCase); InitDirectoryWatcher(); Folders.CollectionChanged += (sender, args) => { switch (args.Action) { case NotifyCollectionChangedAction.Add: case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Replace: args.OldItems?.OfType <GameFolder>() .Where(folder => folder.IsJunction) .ForEach(folder => JunctionTargetsDictionary.Remove(folder.JunctionTarget, folder)); args.NewItems?.OfType <GameFolder>() .Where(folder => folder.IsJunction) .ForEach(folder => JunctionTargetsDictionary.Add(folder.JunctionTarget, folder)); break; case NotifyCollectionChangedAction.Reset: JunctionTargetsDictionary.Clear(); break; case NotifyCollectionChangedAction.Move: break; default: throw new ArgumentOutOfRangeException(); } }; }
/// <summary> /// <see cref="ServiceBase.OnStart"/> override. /// Creates an internal <see cref="Task"/> which is run on the <see cref="AsyncContextThread"/> and awaits its completion without blocking. /// Appropriately sets ServiceBase.ExitCode depending on Task completion state and logs exceptions to Windows Application Eventlog. /// </summary> /// <param name="args">The commandline arguments passed to the service.</param> protected override void OnStart(string[] args) { _cts = new CancellationTokenSource(); _pts = new PauseTokenSource(); _contextThread = new AsyncContextThread(); try { this.ExitCode = 0; this.Status = AsyncServiceStatus.StartPending; // create a new long running task _runTask = _contextThread.Factory.Run(() => RunServiceAsync(args, _cts.Token, _pts.Token)); // if the task completed normally, just stop the service and exit _runTask.ContinueWith(t => Stop(), CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Default); // if the task was canceled in OnStop() just write a debug message _runTask.ContinueWith(t => Debug.WriteLine("ReceiveTask canceled"), CancellationToken.None, TaskContinuationOptions.OnlyOnCanceled, TaskScheduler.Default); // if the task faulted, handle the exception _runTask.ContinueWith(t => HandleException(t.Exception), CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default); // await the completion of the task without blocking the OnStart() call from SCM _runTask.WaitAsync(_cts.Token).ConfigureAwait(false); } catch (Exception e) { EventLog.WriteEntry(e.Message, EventLogEntryType.Error); } finally { this.Status = AsyncServiceStatus.Running; } }
private async Task Crawl() { var cancellation = new CancellationTokenSource(); var pause = new PauseTokenSource(); crawlBlogsCancellation = cancellation; crawlBlogsPause = pause; crawlerService.IsCrawl = true; crawlCommand.RaiseCanExecuteChanged(); pauseCommand.RaiseCanExecuteChanged(); stopCommand.RaiseCanExecuteChanged(); for (var i = 0; i < shellService.Settings.ParallelBlogs; i++) { runningTasks.Add(Task.Run(() => RunCrawlerTasks(cancellation.Token, pause.Token))); } try { await Task.WhenAll(runningTasks.ToArray()); } catch {} finally { runningTasks.Clear(); } }
public async Task SendBulkMailAsync(IEnumerable <MailMessage> emails) { _pauseTokenSource = new PauseTokenSource(); _cancellationTokenSource = new CancellationTokenSource(); var ct = _cancellationTokenSource.Token; var mails = emails.ToArray(); var sentMail = 0; var sendDelay = Task.Delay(1000, ct); var sendComplete = 0; foreach (var mail in mails) { await SendMailAsync(mail); // Report finish after OnSendBulkMailProgress(++sendComplete, mails.Length); // Check send rate sentMail++; if (sentMail >= MaxSendRate) { await sendDelay; sentMail = 0; sendDelay = Task.Delay(1000, ct); } // Cancel if (ct.IsCancellationRequested) { break; } // Pause await _pauseTokenSource.Token.WaitWhilePausedAsync(); } }
private void Crawl() { var cancellation = new CancellationTokenSource(); var pause = new PauseTokenSource(); crawlBlogsCancellation = cancellation; crawlBlogsPause = pause; crawlerService.IsCrawl = true; crawlCommand.RaiseCanExecuteChanged(); pauseCommand.RaiseCanExecuteChanged(); stopCommand.RaiseCanExecuteChanged(); removeBlogCommand.RaiseCanExecuteChanged(); for (int i = 0; i < shellService.Settings.ParallelBlogs; i++) { runningTasks.Add( Task.Factory.StartNew(() => runCrawlerTasks(cancellation.Token, pause.Token), cancellation.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default).ContinueWith(task => { if (task.Exception != null) { foreach (var innerEx in task.Exception.InnerExceptions) { Logger.Error("ManagerController:Crawl: {0}", innerEx); //shellService.ShowError(innerEx, Resources.CrawlerError); } } runningTasks.Clear(); })); } }
private async Task CrawlWork(Crawler crawler, Job job) { var pauseSource = new PauseTokenSource(); var crawlTask = crawler.Crawl(job, _cancelSource.Token, pauseSource.Token); while (!crawlTask.IsCanceled && !crawlTask.IsCompleted && !_cancelSource.IsCancellationRequested) { if (Console.KeyAvailable) { var key = Console.ReadKey(true).Key; //if (key == ConsoleKey.P) //{ // pauseSource.IsPaused = !pauseSource.IsPaused; // https://stackoverflow.com/a/21712588 // Console.WriteLine($"Processing {(pauseSource.IsPaused ? "paused" : "resumed")}"); //} } Thread.Sleep(10); } var result = await crawlTask; }
public PauseToken(PauseTokenSource source) { m_source = source; }
internal PauseToken(PauseTokenSource source) => _Source = source;
public GoogleDriveProgressViewModel(PauseTokenSource pts, CancellationTokenSource cts) : base(pts, cts) { Items = new List <GoogleDriveProgressItemViewModel>(); }
public GoogleDriveProgressItemViewModel(PauseTokenSource pts, CancellationTokenSource cts) : base(pts, cts) { }
//Create the thread that will run the job private void CreateTask(string processID, string jobID, string invokeMeta, string parameters, bool isSync) { var invokeMetaObj = JsonConvert.DeserializeObject <InvokeMeta>(invokeMeta, SerializerSettings.Settings); var type = GetTypeFromAllAssemblies(invokeMetaObj.Type); var parameterTypes = JsonConvert.DeserializeObject <Type[]>(invokeMetaObj.ParameterTypes, SerializerSettings.Settings); var methodInfo = type.GetNonOpenMatchingMethod(invokeMetaObj.Method, parameterTypes); if (methodInfo == null) { throw new InvalidOperationException(string.Format("The type '{0}' has no method with signature '{1}({2})'", type.FullName, invokeMetaObj.Method, string.Join(", ", parameterTypes.Select(x => x.Name)))); } object instance = null; if (!methodInfo.IsStatic) //not static? { instance = Helpers.CreateInstance(type); //create object method instance } Task jobTask = null; if (taskList.ContainsKey(jobID)) { jobTask = taskList[jobID].JobTask; if (jobTask != null && !jobTask.IsCompleted) //already running and NOT completed? { return; } } //Don't use ConfigureWait(false) in Task.Run(), since some tasks don't have Cancellation token and must use the original context to return after completion var taskInfo = new TaskInfo(); var cancelSource = new CancellationTokenSource(); var cancelToken = cancelSource.Token; if (Helpers.HasToken(methodInfo.GetParameters(), "System.Threading.CancellationToken")) { taskInfo.CancelSource = cancelSource; } var pauseSource = new PauseTokenSource(); var pauseToken = pauseSource.Token; if (Helpers.HasToken(methodInfo.GetParameters(), "Shift.Entities.PauseToken")) { taskInfo.PauseSource = pauseSource; } //Keep track of running thread //If using Task.Run(), MUST register task in TaskList right away if NOT the CleanUp() method may mark running Task as Error, because it's running but not in list!!! taskList[jobID] = taskInfo; if (isSync) { jobTask = Task.Run(() => ExecuteJobAsync(processID, jobID, methodInfo, parameters, instance, cancelToken, pauseToken, isSync).GetAwaiter().GetResult(), cancelToken); } else { jobTask = Task.Run(async() => await ExecuteJobAsync(processID, jobID, methodInfo, parameters, instance, cancelToken, pauseToken, isSync).ConfigureAwait(false), cancelToken); } taskInfo.JobTask = jobTask; taskList[jobID] = taskInfo; //re-update with filled Task }
public static IObservable <T> FromPollingPattern <TState, T>(this TState state, Func <TState, T> refresh, out PauseTokenSource pts, out CancellationTokenSource cts, ulong timeToSleepMs = 0) { var result = new PollingWrapper <TState, T>(state, refresh, timeToSleepMs); cts = result.CancellationTokenSource; pts = result.PauseTokenSource; return(result); }
/// <inheritdoc/> public PausingDelegateListCommand(Func <IEnumerable <T> > applicableItemsFunc, [NotNull] Func <T, Task> individualExecuteMethod, [CanBeNull] PauseTokenSource tokenSource, Func <IList <T>, Task <bool> > shouldExecuteFunc = null) : base(applicableItemsFunc) { IndividualExecuteMethod = individualExecuteMethod; TokenSource = tokenSource ?? new PauseTokenSource(); ShouldExecuteFunc = shouldExecuteFunc; }
private async Task ExecuteJobAsync(string processID, string jobID, MethodInfo methodInfo, string parameters, object instance, CancellationToken?cancelToken, PauseToken?pauseToken, bool isSync) { try { //Set job to Running if (isSync) { jobDAL.SetToRunning(processID, jobID); } else { await jobDAL.SetToRunningAsync(processID, jobID); } var progress = isSync ? UpdateProgressEventAsync(jobID, true).GetAwaiter().GetResult() : await UpdateProgressEventAsync(jobID, false); //Need this to update the progress of the job's //Invoke Method if (cancelToken == null) { var cancelSource = new CancellationTokenSource(); cancelToken = cancelSource.Token; } if (pauseToken == null) { var pauseSource = new PauseTokenSource(); pauseToken = pauseSource.Token; } var arguments = DALHelpers.DeserializeArguments(cancelToken.Value, pauseToken.Value, progress, methodInfo, parameters); var result = methodInfo.Invoke(instance, arguments); //handle async method invocation var task = result as Task; if (task != null) { if (isSync) { task.GetAwaiter().GetResult(); } else { await task; } } } catch (OperationCanceledException exc) { if (isSync) { SetToStoppedAsync(new List <string> { jobID }, isSync).GetAwaiter().GetResult(); } else { await SetToStoppedAsync(new List <string> { jobID }, isSync); } throw exc; } catch (TargetInvocationException exc) { if (exc.InnerException is OperationCanceledException) { if (isSync) { SetToStoppedAsync(new List <string> { jobID }, isSync).GetAwaiter().GetResult(); } else { await SetToStoppedAsync(new List <string> { jobID }, isSync); } throw exc.InnerException; } else { var job = isSync ? jobDAL.GetJob(jobID) : await jobDAL.GetJobAsync(jobID); if (job != null) { var error = job.Error + " " + exc.ToString(); var count = isSync ? SetErrorAsync(processID, job.JobID, error, isSync).GetAwaiter().GetResult() : await SetErrorAsync(processID, job.JobID, error, isSync); } throw exc; } } catch (Exception exc) { var job = isSync ? jobDAL.GetJob(jobID) : await jobDAL.GetJobAsync(jobID); if (job != null) { var error = job.Error + " " + exc.ToString(); var count = isSync ? SetErrorAsync(processID, job.JobID, error, isSync).GetAwaiter().GetResult() : await SetErrorAsync(processID, job.JobID, error, isSync); } throw exc; } //Completed successfully with no error if (isSync) { jobDAL.SetToCompleted(processID, jobID); } else { await jobDAL.SetToCompletedAsync(processID, jobID); } }
public FlatWizardVM(IProfileService profileService, IImagingVM imagingVM, ICameraMediator cameraMediator, IFilterWheelMediator filterWheelMediator, ITelescopeMediator telescopeMediator, IFlatDeviceMediator flatDeviceMediator, IApplicationResourceDictionary resourceDictionary, IApplicationStatusMediator applicationStatusMediator) : base(profileService) { Title = "LblFlatWizard"; ImageGeometry = (System.Windows.Media.GeometryGroup)resourceDictionary["FlatWizardSVG"]; ImagingVM = imagingVM; this.applicationStatusMediator = applicationStatusMediator; flatSequenceCts?.Dispose(); flatSequenceCts = new CancellationTokenSource(); var pauseTokenSource = new PauseTokenSource(); Gain = -1; StartFlatSequenceCommand = new AsyncCommand <bool>( () => StartSingleFlatCapture(new Progress <ApplicationStatus>(p => Status = p), pauseTokenSource.Token), (object o) => cameraInfo.Connected ); StartMultiFlatSequenceCommand = new AsyncCommand <bool>( () => StartMultiFlatCapture(new Progress <ApplicationStatus>(p => Status = p), pauseTokenSource.Token), (object o) => cameraInfo.Connected && filterWheelInfo.Connected ); SlewToZenithCommand = new AsyncCommand <bool>( () => SlewToZenith(), (object o) => telescopeInfo.Connected ); CancelFlatExposureSequenceCommand = new RelayCommand(CancelFindExposureTime); PauseFlatExposureSequenceCommand = new RelayCommand(obj => { IsPaused = true; pauseTokenSource.IsPaused = IsPaused; }); ResumeFlatExposureSequenceCommand = new RelayCommand(obj => { IsPaused = false; pauseTokenSource.IsPaused = IsPaused; }); FlatCount = profileService.ActiveProfile.FlatWizardSettings.FlatCount; DarkFlatCount = profileService.ActiveProfile.FlatWizardSettings.DarkFlatCount; BinningMode = profileService.ActiveProfile.FlatWizardSettings.BinningMode; Filters = new ObservableCollection <FlatWizardFilterSettingsWrapper>(); profileService.ProfileChanged += (sender, args) => { UpdateSingleFlatWizardFilterSettings(profileService); watchedFilterList.CollectionChanged -= FiltersCollectionChanged; watchedFilterList = profileService.ActiveProfile.FilterWheelSettings.FilterWheelFilters; watchedFilterList.CollectionChanged += FiltersCollectionChanged; UpdateFilterWheelsSettings(); }; watchedFilterList = profileService.ActiveProfile.FilterWheelSettings.FilterWheelFilters; watchedFilterList.CollectionChanged += FiltersCollectionChanged; // first update filters UpdateSingleFlatWizardFilterSettings(profileService); UpdateFilterWheelsSettings(); // then register consumer and get the cameraInfo so it's populated to all filters including the singleflatwizardfiltersettings this.cameraMediator = cameraMediator; cameraMediator.RegisterConsumer(this); this.filterWheelMediator = filterWheelMediator; filterWheelMediator.RegisterConsumer(this); this.telescopeMediator = telescopeMediator; this.telescopeMediator.RegisterConsumer(this); // register the flat panel mediator _flatDeviceMediator = flatDeviceMediator; _flatDeviceMediator.RegisterConsumer(this); TargetName = "FlatWizard"; }
internal PauseToken(PauseTokenSource source) { m_source = source; }
private async void btnSearch_Click(object sender, EventArgs e) { int listCount = m_downloadList.Count; if (listCount == 0 && this.txtUrl.Text.Trim().Length == 0) { this.ShowMessage("Please type a URL for which to download resources or open a URL list file."); return; } if (this.txtDestination.Text.Trim().Length == 0) { bool nodest = m_downloadList.All(dli => string.IsNullOrWhiteSpace(dli.DestinationFolder)); if (nodest) { this.ShowMessage("Please enter a destination folder for downloads."); return; } } m_cancel = false; m_pauseTokenSource = new PauseTokenSource(); m_cancelTokenSource = new CancellationTokenSource(); this.DownloadUpdateControls(false); try { if (listCount > 0) { try { this.tssProgressList.Value = 0; this.tssProgressList.Maximum = listCount; this.tssProgressList.Visible = true; int total = listCount; while (listCount > 0) { var item = m_downloadList[0]; this.tssProgressList.Value += 1; this.tssItemCount.Text = string.Format("Processing URL... {0} of {1} | ", this.tssProgressList.Value, total); await this.SearchImages(item.SourceUrl, m_cancelTokenSource.Token, m_pauseTokenSource.Token, item.DestinationFolder); m_downloadList.Remove(item); listCount--; if (m_cancel) { break; } } } catch (Exception ex) { this.ShowError(ex); } this.tssProgressList.Visible = false; this.tssItemCount.Text = string.Format("Images found: {0}", this.clbImageList.Items.Count); } else { await this.SearchImages(this.txtUrl.Text.Trim(), m_cancelTokenSource.Token, m_pauseTokenSource.Token); } } catch (Exception) { } this.DownloadUpdateControls(true); }