Project Name File Name Usage Source Code Link
soundfingerprinting PathListViewModel.cs Task.Factory.StartNew( () => { duplicates = _gate.FindAllDuplicates( (track, total, current) => { CurrentProgress = (int) Math.Ceiling(((float) (current)/total*100)); if (current >= total) { _processedMusicItems = current; /*set processed unit items*/ CurrentProgress = 0; } }); }).ContinueWith( /*Update the UI*/ (task) => { ProcessingStep = SETP_GENERATING_REPORT; ReportViewModel report = new ReportViewModel {Sets = duplicates}; GenericViewModel viewModel = new GenericViewModel(); viewModel.Workspaces.Add(report); IGenericViewWindow view = GetService(); IWindowService windowMediator = GetService(); windowMediator.ShowDialog(view, viewModel, ((o, args) => report.StopPlaying())); ProcessingStep = STEP_SELECT_ROOT_FOLDER; IsProcessing = false; }, TaskScheduler) Link To Source File
dotRant IrcClient.cs client.ConnectAsync(hostname, port, secureConnection).ContinueWith(task => { Send(new IrcCommand(null, "PASS", "*")); Send(new IrcCommand(null, "NICK", nick)); Send(new IrcCommand(null, "USER", "dotRant", "8", "*", fullName.AsIrcRestParameter())); // PASS * // NICK // USER dotRant 8 * : connectionWait.WaitOne(); }) Link To Source File
MangaEplision Global.cs Task.Factory.StartNew(() => { BinaryFormatter binf = new BinaryFormatter(); LoadSource(); var fs = new FileStream(CatalogFilename, FileMode.Create); var dict = MangaSource.GetAvailableManga(); binf.Serialize(fs, dict); fs.Close(); fs.Dispose(); }).ContinueWith((obj) => { Application.Current.Dispatcher.Invoke( new EmptyDelegate(() => { prog.Close(); })); LoadCatalog(true); }) Link To Source File
MangaEplision SearchWindow.xaml.cs Task.Factory.StartNew(() => { info = Global.GetMangaInfo(name); }).ContinueWith((tsk) => { if (tsk.Exception == null) Dispatcher.BeginInvoke( new EmptyDelegate( () => { ((MainWindow)Application.Current.MainWindow).InvokeReadManga(info); this.Close(); })); else MessageBox.Show("There was an error grabbing information on that manga!" + Environment.NewLine + "Geeky error details: " + Environment.NewLine + Environment.NewLine + tsk.Exception.ToString() + Environment.NewLine + Environment.NewLine + "NOTE: You can press CTRL + C to copy the contents of this message!"); tsk.Dispose(); }) Link To Source File
MangaEplision MainWindow.xaml.cs Task.Factory.StartNew(() => { info = Global.GetMangaInfo(name); }).ContinueWith((tsk) => { if (tsk.Exception == null) Dispatcher.BeginInvoke( new EmptyDelegate( () => { MetroTabItem mti = new MetroTabItem(); mti.IsClosable = true; mti.Header = info.MangaName; mti.Content = new MangaInfoControl(info); metroTabControl1.Items.Add(mti); metroTabControl1.SelectedItem = mti; })); else MessageBox.Show("There was an error grabbing information on that manga!" + Environment.NewLine + "Geeky error details: " + Environment.NewLine + Environment.NewLine + tsk.Exception.ToString() + Environment.NewLine + Environment.NewLine + "NOTE: You can press CTRL + C to copy the contents of this message!"); tsk.Dispose(); }) Link To Source File
Web-Critters WebCrittersForm.cs Task.Factory.StartNew(() => { for (int i = 0; i < generationCount; i++) { if (token.IsCancellationRequested) return; this.CasSimulation.RunGeneration(); } }) .ContinueWith(t => { if (t.IsFaulted && t.Exception != null) DisplayException(t.Exception); this.Invoke(new MethodInvoker(() => { this.UpdateSimulationDetails(true); this.runGenerations.Enabled = true; this.stopButton.Enabled = false; })); }) Link To Source File
CouchDude ExceptionUtilsTests.cs Task.Factory .StartNew( () => { throw new InvalidOperationException("inner inner inner exception"); } ).ContinueWith( t => { throw t.Exception.InnerException.PreserveStackTrace(); } ) Link To Source File
CouchDude ExceptionUtilsTests.cs task.ContinueWith(t => { exception = t.Exception; }) Link To Source File
CouchDude TaskUtilsTasks.cs Task.Factory .StartNew( () => { throw new AggregateException( new AggregateException( new AggregateException( new Exception("one"), new Exception("two") ), new Exception("three"), new AggregateException( new AggregateException() ) ) ); }) .ContinueWith( t => { throw new AggregateException( t.Exception, new AggregateException(), new Exception("four") ); }) Link To Source File
CouchDude TaskUtilsTasks.cs Task.Factory .StartNew( () => { throw new InvalidOperationException("inner inner inner exception"); } ) .ContinueWith( t => { throw new AggregateException(t.Exception); } ) Link To Source File
CouchDude TaskUtilsTasks.cs Task.Factory .StartNew( () => { throw new InvalidOperationException("inner inner inner exception"); } ) .ContinueWith( t => { Debug.Assert(t.Exception != null); var ie = t.Exception.InnerException; Debug.Assert(ie != null); throw new ArgumentException(ie.Message, ie); } ) Link To Source File
ASP.NET-Mvc-3 RazorEditorParser.cs Task.ContinueWith(t => { Interlocked.Decrement(ref _activeTaskCount); CancelSource.Dispose(); t.Dispose(); }) Link To Source File
mono-reactive TaskObservableExtensions.cs task.ContinueWith (onEnd) Link To Source File
CSC431 Step.cs t.ContinueWith(_ => { //it ~should~ be ok to use dynamic like this as the //FollowWith functions should have ensured that types lined up dynamic ds = s; dynamic res = ds.Output; foreach (var n in s.nexts) { dynamic dn = n; dn.Input = res; } }) Link To Source File
AutoMapper MultiThreadingIssues.cs Task.Factory.StartNew( doMapping ).ContinueWith( a => { if (Interlocked.Increment(ref _done) == threadCount) { _allDone.Set( ) ; } } ) Link To Source File
NDistribUnit CrossThreadPipe.cs latterTask.ContinueWith(task => action()) Link To Source File
NDistribUnit CrossThreadPipe.cs latterTask.ContinueWith(task => closeAction()) Link To Source File
NDistribUnit RunResultsCollection.cs task.ContinueWith(t => PerformAsyncMerging()) Link To Source File
practice MainWindow.xaml.cs Task.Factory.StartNew(() => this.SaveUri(uri, rootDirectory)).ContinueWith(t => this.DownloadProgressBar.Value += 1, uiSyncContext) Link To Source File
ILoveLucene TaskExtensions.cs task.ContinueWith(t => { if (t.Exception != null) { callback(t.Exception); } }) Link To Source File
ILoveLucene TaskExtensions.cs task.ContinueWith(t => { if (t.Exception != null) { callback(t, t.Exception); } }) Link To Source File
Baby CachedUrlProvider.cs slowWrite.ContinueWith((t) => { if (t.Exception != null) { throw t.Exception; } }) Link To Source File
Lokad.Cloud TaskFactoryExtensions.cs StartAsyncDelay(delay, null, cancellationToken) .ContinueWith(delayTask => { if (delayTask.IsCanceled) { completionSource.TrySetCanceled(); } else { RetryInternalWithResult(factory, taskProvider, completionSource, cancellationToken, shouldRetry, trial + 1); } }) Link To Source File
Lokad.Cloud TaskFactoryExtensions.cs task.ContinueWith(t => { TimeSpan delay; if (!shouldRetry(trial, t.Exception, out delay)) { completionSource.TrySetException(t.Exception.InnerExceptions); } else { StartAsyncDelay(delay, null, cancellationToken) .ContinueWith(delayTask => { if (delayTask.IsCanceled) { completionSource.TrySetCanceled(); } else { RetryInternal(factory, taskProvider, completionSource, cancellationToken, shouldRetry, trial + 1); } }); } }, TaskContinuationOptions.OnlyOnFaulted) Link To Source File
Lokad.Cloud TaskFactoryExtensions.cs StartAsyncDelay(delay, null, cancellationToken) .ContinueWith(delayTask => { if (delayTask.IsCanceled) { completionSource.TrySetCanceled(); } else { RetryInternal(factory, taskProvider, completionSource, cancellationToken, shouldRetry, trial + 1); } }) Link To Source File
ionfish PicasaImageUploader.cs task.ContinueWith(x => x.Dispose()) Link To Source File
coapp CoAppMain.cs task.ContinueWith(antecedent => { if (!(antecedent.IsFaulted || antecedent.IsCanceled)) { WaitForPackageManagerToComplete(); } }) Link To Source File
coapp Installer.cs packageManager.GetPackageDetails(antecedent.Result.FirstOrDefault().CanonicalName, _messages).ContinueWith((antecedent2) => { if (antecedent.IsFaulted || antecedent.Result.IsNullOrEmpty()) { OnReady(); // DOERROR return; } try { UpgradedPackage = antecedent.Result.FirstOrDefault(); ExtractTrickyPackageInfo(); } catch { } OnPropertyChanged(); OnReady(); }, TaskContinuationOptions.AttachedToParent) Link To Source File
coapp Installer.cs packageManager.GetPackageDetails(antecedent.Result.FirstOrDefault().CanonicalName, _messages).ContinueWith((antecedent2) => { if (antecedent.IsFaulted || antecedent.Result.IsNullOrEmpty()) { OnReady(); // DOERROR return; } try { SpecifiedPackage = antecedent.Result.FirstOrDefault(); ExtractTrickyPackageInfo(); } catch { } ProbeForNewerPackageInfo(); OnPropertyChanged(); OnReady(); }, TaskContinuationOptions.AttachedToParent) Link To Source File
coapp Installer.cs packageManager.InstallPackage(Package.CanonicalName, autoUpgrade: false, messages: new PackageManagerMessages { InstallingPackageProgress = (canonicalName, progress, overallProgress) => { Progress = overallProgress; }, InstalledPackage = (canonicalName) => { Package.GetPackage(canonicalName).IsInstalled = true; }, OperationCancelled = CancellationRequestedDuringInstall, }.Extend(_messages)).ContinueWith(antecedent => OnFinished(), TaskContinuationOptions.AttachedToParent) Link To Source File
coapp Installer.cs packageManager.RemovePackage(Package.CanonicalName, messages: new PackageManagerMessages { RemovingPackageProgress= (canonicalName, progress) => { Progress = progress; }, RemovedPackage = (canonicalName ) => { Package.GetPackage(canonicalName).IsInstalled = false; }, OperationCancelled = CancellationRequestedDuringRemove, }).ContinueWith(antecedent => { OnFinished(); }, TaskContinuationOptions.AttachedToParent) Link To Source File
coapp InstallerPrep.cs PackageManager.Instance.GetEngineStatus(new PackageManagerMessages { UnexpectedFailure = (ex) => { _currentPercent = -2; }, Error = (s1, s2, s3) => { _currentPercent = -3; }, OperationCancelled = (s1) => { _currentPercent = -4; }, EngineStatus = (percentComplete) => { _currentPercent = percentComplete; } }).ContinueWith((antecedent) => { _currentPercent = 100; }, TaskContinuationOptions.AttachedToParent) Link To Source File
coapp PackageManager.cs FindPackages( /* canonicalName:*/ null, /* name */null, /* version */null, /* arch */ null, /* pkt */null, dependencies, installed, active, required, blocked, latest, /* index */null, /* max-results */null, location, forceScan, new PackageManagerMessages { PackageInformation = package => packages.Add(package), }.Extend(messages)).ContinueWith(antecedent => { if( antecedent.IsFaulted || antecedent.IsCanceled ) { throw antecedent.Exception.Flatten().InnerExceptions.FirstOrDefault(); } return packages as IEnumerable; }, TaskContinuationOptions.AttachedToParent) Link To Source File
coapp PackageManager.cs RecognizeFile(null, localPath, null, new PackageManagerMessages { PackageInformation = package => { singleResult = package; }, FeedAdded = feedLocation => { feedAdded = feedLocation; } }.Extend(messages)).ContinueWith(antecedent => { if (singleResult != null) { return AddFeed(originalDirectory, true, new PackageManagerMessages { // don't have to handle any messages here... }.Extend(messages)).ContinueWith(antecedent2 => singleResult.SingleItemAsEnumerable(), TaskContinuationOptions.AttachedToParent). Result; } // if it was a feed, then continue with the big query if (feedAdded != null) { return InternalGetPackages(null, minVersion, maxVersion, dependencies, installed, active, required, blocked, latest, feedAdded, forceScan, messages).Result; } // if we get here, that means that we didn't recognize the file. // we're gonna return an empty collection at this point. return singleResult.SingleItemAsEnumerable(); }, TaskContinuationOptions.AttachedToParent) Link To Source File
coapp PackageManager.cs AddFeed(originalDirectory, true, new PackageManagerMessages { // don't have to handle any messages here... }.Extend(messages)).ContinueWith(antecedent2 => singleResult.SingleItemAsEnumerable(), TaskContinuationOptions.AttachedToParent) Link To Source File
coapp PackageManager.cs AddFeed(parameter, true, new PackageManagerMessages { FeedAdded = feedLocation => { feedAdded = feedLocation; } }.Extend(messages)).ContinueWith(antecedent => { // if it was a feed, then continue with the big query if (feedAdded != null) { // this overrides any passed in locations with just the feed added. return InternalGetPackages(null, minVersion, maxVersion, dependencies, installed, active, required, blocked, latest, feedAdded, forceScan, messages).Result; } // if we get here, that means that we didn't recognize the file. // we're gonna return an empty collection at this point. return singleResult.SingleItemAsEnumerable(); }, TaskContinuationOptions.AttachedToParent) Link To Source File
coapp PackageManager.cs FindPackages(packageName != null && packageName.IsFullMatch ? packageName.CanonicalName : null, packageName == null ? null : packageName.Name, packageName == null ? null : packageName.Version, packageName == null ? null : packageName.Arch, packageName == null ? null : packageName.PublicKeyToken, dependencies, installed, active, required, blocked, latest, null, null, location, forceScan, new PackageManagerMessages { PackageInformation = package => { if ((!minVersion.HasValue || package.Version.VersionStringToUInt64() >= minVersion) && (!maxVersion.HasValue || package.Version.VersionStringToUInt64() <= maxVersion)) { packages.Add(package); } }, }.Extend(messages)).ContinueWith(antecedent => { if( antecedent.IsFaulted || antecedent.IsCanceled ) { throw antecedent.Exception.Flatten().InnerExceptions.FirstOrDefault(); } return packages as IEnumerable; }, TaskContinuationOptions.AttachedToParent) Link To Source File
coapp EngineService.cs listenTask.ContinueWith(t => { if (t.IsCanceled || _cancellationTokenSource.Token.IsCancellationRequested) { return; } StartListener(); // start next one! if (serverPipe.IsConnected) { var serverInput = new byte[BufferSize]; serverPipe.ReadAsync(serverInput, 0, serverInput.Length).AutoManage().ContinueWith(antecedent => { var rawMessage = Encoding.UTF8.GetString(serverInput, 0, antecedent.Result); if (string.IsNullOrEmpty(rawMessage)) { return; } var requestMessage = new UrlEncodedMessage(rawMessage); // first command must be "startsession" if (!requestMessage.Command.Equals("start-session", StringComparison.CurrentCultureIgnoreCase)) { return; } // verify that user is allowed to connect. try { var hasAccess = false; serverPipe.RunAsClient(() => { hasAccess = PermissionPolicy.Connect.HasPermission; }); if (!hasAccess) return; } catch { return; } // check for the required parameters. // close the session if they are not here. if (string.IsNullOrEmpty(requestMessage["id"]) || string.IsNullOrEmpty(requestMessage.Data["client"])) { return; } var isAsync = (bool?) requestMessage["async"]; if (isAsync.HasValue && isAsync.Value == false) { StartResponsePipeAndProcessMesages(requestMessage.Data["client"], requestMessage["id"], serverPipe); } else { Session.Start(requestMessage.Data["client"], requestMessage["id"], serverPipe, serverPipe); } }).Wait(); } }, _cancellationTokenSource.Token, TaskContinuationOptions.AttachedToParent, TaskScheduler.Current) Link To Source File
coapp Session.cs // when the task is done, call end. _task.ContinueWith((antecedent) => End()) Link To Source File
coapp Session.cs _responsePipe.WriteLineAsync(_outputQueue.Peek().ToString()).ContinueWith(antecedent => { lock (_outputQueue) { _outputQueue.Dequeue(); } }, TaskContinuationOptions.NotOnFaulted) Link To Source File
coapp Session.cs dispatchTask.ContinueWith(dispatchAntecedent => { try { // had to force this to ensure that async writes are at least in the pipe // before waiting on the pipe drain. // without this, it is possible that the async writes are still 'getting to the pipe' // and not actually in the pipe, **even though the async write is complete** Thread.Sleep(50); if (_responsePipe != null) { _responsePipe.WaitForPipeDrain(); WriteAsync(new UrlEncodedMessage("task-complete") { { "rqid", rqid } }); } } catch (Exception e) { Logger.Error(e); // supress any exceptions. } }) Link To Source File
coapp Session.cs task.ContinueWith(antecedent => { if (antecedent.Exception != null) { foreach (var failure in antecedent.Exception.Flatten().InnerExceptions.Where(failure => failure.GetType() != typeof(AggregateException))) { Logger.Error(failure); WriteAsync(new UrlEncodedMessage("unexpected-failure") { {"type", failure.GetType().ToString()}, {"message", failure.Message}, {"stacktrace", failure.StackTrace}, }); } } }, _cancellationTokenSource.Token, TaskContinuationOptions.AttachedToParent | TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Current) Link To Source File
devtools PeBinary.cs _loading.ContinueWith((antecedent) => { // check each of the assembly references, if (IsManaged) { foreach (var ar in MutableAssembly.AssemblyReferences) { if (!ar.PublicKeyToken.Any()) { // dependent assembly isn't signed. // look for it. var dep = FindAssembly(ar.Name.Value, ar.Version.ToString()); if (dep == null) { Console.WriteLine("WARNING: Unsigned Dependent Assembly {0}-{1} not found.", ar.Name.Value, ar.Version.ToString()); } else { // we've found an unsigned dependency -- we're gonna remember this file for later. UnsignedDependentBinaries.Add(dep); } } } } }) Link To Source File
_toolkit_deprecated Installer.cs packageManager.GetPackageDetails(antecedent.Result.FirstOrDefault().CanonicalName, _messages).ContinueWith((antecedent2) => { if (antecedent.IsFaulted || antecedent.Result.IsNullOrEmpty()) { OnReady(); // DOERROR return; } try { UpgradedPackage = antecedent.Result.FirstOrDefault(); ExtractTrickyPackageInfo(); } catch { } OnPropertyChanged(); OnReady(); }, TaskContinuationOptions.AttachedToParent) Link To Source File
_toolkit_deprecated Installer.cs packageManager.GetPackageDetails(antecedent.Result.FirstOrDefault().CanonicalName, _messages).ContinueWith((antecedent2) => { if (antecedent.IsFaulted || antecedent.Result.IsNullOrEmpty()) { OnReady(); // DOERROR return; } try { SpecifiedPackage = antecedent.Result.FirstOrDefault(); ExtractTrickyPackageInfo(); } catch { } ProbeForNewerPackageInfo(); OnPropertyChanged(); OnReady(); }, TaskContinuationOptions.AttachedToParent) Link To Source File
_toolkit_deprecated Installer.cs packageManager.InstallPackage(Package.CanonicalName, autoUpgrade: false, messages: new PackageManagerMessages { InstallingPackageProgress = (canonicalName, progress, overallProgress) => { Progress = overallProgress; }, InstalledPackage = (canonicalName) => { Package.GetPackage(canonicalName).IsInstalled = true; }, OperationCancelled = CancellationRequestedDuringInstall, }.Extend(_messages)).ContinueWith(antecedent => OnFinished(), TaskContinuationOptions.AttachedToParent) Link To Source File
_toolkit_deprecated Installer.cs packageManager.RemovePackage(Package.CanonicalName, messages: new PackageManagerMessages { RemovingPackageProgress= (canonicalName, progress) => { Progress = progress; }, RemovedPackage = (canonicalName ) => { Package.GetPackage(canonicalName).IsInstalled = false; }, OperationCancelled = CancellationRequestedDuringRemove, }).ContinueWith(antecedent => { OnFinished(); }, TaskContinuationOptions.AttachedToParent) Link To Source File
_toolkit_deprecated InstallerPrep.cs PackageManager.Instance.GetEngineStatus(new PackageManagerMessages { UnexpectedFailure = (ex) => { _currentPercent = -2; }, Error = (s1, s2, s3) => { _currentPercent = -3; }, OperationCancelled = (s1) => { _currentPercent = -4; }, EngineStatus = (percentComplete) => { _currentPercent = percentComplete; } }).ContinueWith((antecedent) => { _currentPercent = 100; }, TaskContinuationOptions.AttachedToParent) Link To Source File
_toolkit_deprecated PackageManager.cs FindPackages( /* canonicalName:*/ null, /* name */null, /* version */null, /* arch */ null, /* pkt */null, dependencies, installed, active, required, blocked, latest, /* index */null, /* max-results */null, location, forceScan, new PackageManagerMessages { PackageInformation = package => packages.Add(package), }.Extend(messages)).ContinueWith(antecedent => { if( antecedent.IsFaulted || antecedent.IsCanceled ) { throw antecedent.Exception.Flatten().InnerExceptions.FirstOrDefault(); } return packages as IEnumerable; }, TaskContinuationOptions.AttachedToParent) Link To Source File
_toolkit_deprecated PackageManager.cs RecognizeFile(null, localPath, null, new PackageManagerMessages { PackageInformation = package => { singleResult = package; }, FeedAdded = feedLocation => { feedAdded = feedLocation; } }.Extend(messages)).ContinueWith(antecedent => { if (singleResult != null) { return AddFeed(originalDirectory, true, new PackageManagerMessages { // don't have to handle any messages here... }.Extend(messages)).ContinueWith(antecedent2 => singleResult.SingleItemAsEnumerable(), TaskContinuationOptions.AttachedToParent). Result; } // if it was a feed, then continue with the big query if (feedAdded != null) { return InternalGetPackages(null, minVersion, maxVersion, dependencies, installed, active, required, blocked, latest, feedAdded, forceScan, messages).Result; } // if we get here, that means that we didn't recognize the file. // we're gonna return an empty collection at this point. return singleResult.SingleItemAsEnumerable(); }, TaskContinuationOptions.AttachedToParent) Link To Source File
_toolkit_deprecated PackageManager.cs AddFeed(originalDirectory, true, new PackageManagerMessages { // don't have to handle any messages here... }.Extend(messages)).ContinueWith(antecedent2 => singleResult.SingleItemAsEnumerable(), TaskContinuationOptions.AttachedToParent) Link To Source File
_toolkit_deprecated PackageManager.cs AddFeed(parameter, true, new PackageManagerMessages { FeedAdded = feedLocation => { feedAdded = feedLocation; } }.Extend(messages)).ContinueWith(antecedent => { // if it was a feed, then continue with the big query if (feedAdded != null) { // this overrides any passed in locations with just the feed added. return InternalGetPackages(null, minVersion, maxVersion, dependencies, installed, active, required, blocked, latest, feedAdded, forceScan, messages).Result; } // if we get here, that means that we didn't recognize the file. // we're gonna return an empty collection at this point. return singleResult.SingleItemAsEnumerable(); }, TaskContinuationOptions.AttachedToParent) Link To Source File
_toolkit_deprecated PackageManager.cs FindPackages(packageName != null && packageName.IsFullMatch ? packageName.CanonicalName : null, packageName == null ? null : packageName.Name, packageName == null ? null : packageName.Version, packageName == null ? null : packageName.Arch, packageName == null ? null : packageName.PublicKeyToken, dependencies, installed, active, required, blocked, latest, null, null, location, forceScan, new PackageManagerMessages { PackageInformation = package => { if ((!minVersion.HasValue || package.Version.VersionStringToUInt64() >= minVersion) && (!maxVersion.HasValue || package.Version.VersionStringToUInt64() <= maxVersion)) { packages.Add(package); } }, }.Extend(messages)).ContinueWith(antecedent => { if( antecedent.IsFaulted || antecedent.IsCanceled ) { throw antecedent.Exception.Flatten().InnerExceptions.FirstOrDefault(); } return packages as IEnumerable; }, TaskContinuationOptions.AttachedToParent) Link To Source File
_toolkit_deprecated EngineService.cs listenTask.ContinueWith(t => { if (t.IsCanceled || _cancellationTokenSource.Token.IsCancellationRequested) { return; } StartListener(); // start next one! if (serverPipe.IsConnected) { var serverInput = new byte[BufferSize]; serverPipe.ReadAsync(serverInput, 0, serverInput.Length).AutoManage().ContinueWith(antecedent => { var rawMessage = Encoding.UTF8.GetString(serverInput, 0, antecedent.Result); if (string.IsNullOrEmpty(rawMessage)) { return; } var requestMessage = new UrlEncodedMessage(rawMessage); // first command must be "startsession" if (!requestMessage.Command.Equals("start-session", StringComparison.CurrentCultureIgnoreCase)) { return; } // verify that user is allowed to connect. try { var hasAccess = false; serverPipe.RunAsClient(() => { hasAccess = PermissionPolicy.Connect.HasPermission; }); if (!hasAccess) return; } catch { return; } // check for the required parameters. // close the session if they are not here. if (string.IsNullOrEmpty(requestMessage["id"]) || string.IsNullOrEmpty(requestMessage.Data["client"])) { return; } var isAsync = (bool?) requestMessage["async"]; if (isAsync.HasValue && isAsync.Value == false) { StartResponsePipeAndProcessMesages(requestMessage.Data["client"], requestMessage["id"], serverPipe); } else { Session.Start(requestMessage.Data["client"], requestMessage["id"], serverPipe, serverPipe); } }).Wait(); } }, _cancellationTokenSource.Token, TaskContinuationOptions.AttachedToParent, TaskScheduler.Current) Link To Source File
_toolkit_deprecated Session.cs // when the task is done, call end. _task.ContinueWith((antecedent) => End()) Link To Source File
_toolkit_deprecated Session.cs _responsePipe.WriteLineAsync(_outputQueue.Peek().ToString()).ContinueWith(antecedent => { lock (_outputQueue) { _outputQueue.Dequeue(); } }, TaskContinuationOptions.NotOnFaulted) Link To Source File
_toolkit_deprecated Session.cs dispatchTask.ContinueWith(dispatchAntecedent => { try { // had to force this to ensure that async writes are at least in the pipe // before waiting on the pipe drain. // without this, it is possible that the async writes are still 'getting to the pipe' // and not actually in the pipe, **even though the async write is complete** Thread.Sleep(50); if (_responsePipe != null) { _responsePipe.WaitForPipeDrain(); WriteAsync(new UrlEncodedMessage("task-complete") { { "rqid", rqid } }); } } catch (Exception e) { Logger.Error(e); // supress any exceptions. } }) Link To Source File
_toolkit_deprecated Session.cs task.ContinueWith(antecedent => { if (antecedent.Exception != null) { foreach (var failure in antecedent.Exception.Flatten().InnerExceptions.Where(failure => failure.GetType() != typeof(AggregateException))) { Logger.Error(failure); WriteAsync(new UrlEncodedMessage("unexpected-failure") { {"type", failure.GetType().ToString()}, {"message", failure.Message}, {"stacktrace", failure.StackTrace}, }); } } }, _cancellationTokenSource.Token, TaskContinuationOptions.AttachedToParent | TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Current) Link To Source File
Orders InvocationExtentions.cs parent.ContinueWith(task => { if (task.IsFaulted == false) return; Deployment.Current.Dispatcher.InvokeAsync(() => new ErrorWindow(task.Exception.ExtractSingleInnerException()).Show()) .ContinueWith(_ => action(task.Exception)); }) Link To Source File
Orders InvocationExtentions.cs Deployment.Current.Dispatcher.InvokeAsync(() => new ErrorWindow(task.Exception.ExtractSingleInnerException()).Show()) .ContinueWith(_ => action(task.Exception)) Link To Source File
FhvRoomSearch MainViewModel.cs Task.Factory.StartNew(DoSearchAsync).ContinueWith( t => { ProgressState = TaskbarItemProgressState.None; ProgressStatus = "Ready"; RaisePropertyChanged("SearchResults"); }, TaskContinuationOptions.ExecuteSynchronously) Link To Source File
fubumvc AsyncInterceptExceptionBehavior.cs task.ContinueWith(x => { try { //this will allow a catching an exception rather than inspecting task data x.Wait(); } catch (AggregateException e) { var aggregateException = e.Flatten(); aggregateException.InnerExceptions.Each(TryHandle); } }, TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.AttachedToParent) Link To Source File
fubumvc FubuAsyncRouteHandler.cs task.ContinueWith(x => cb(x)) Link To Source File
OpenSolar QueryResultWindow.xaml.cs this.Model.Update(this.Category).ContinueWith(_ => RequestUpdateCount.RaiseEvent(this, EventArgs.Empty)) Link To Source File
MS-OSM-Querys MainController.cs task.ContinueWith(a => { if (a.IsFaulted) { MessageBox.Show("Internal Error!"); } continuation(a); _model.MaxWaysLeft = _ways.Count; _watch.Stop(); _phase = MainControllerStates.Idle; _xmlOSMFileLoader.Dispose(); }) Link To Source File
AwsSesWrapper.Net CommandProcessor.cs Task.Factory.FromAsync(outStream.BeginWrite, outStream.EndWrite, data, 0, data.Length, outStream, TaskCreationOptions.AttachedToParent) .ContinueWith( x => ((Stream) x.AsyncState).Close()) Link To Source File
WinRT.NET TaskAction.cs this.task.ContinueWith (t => { AsyncActionCompletedHandler c = Completed; if (c != null) c (this); }) Link To Source File
RuElect ImportViewModelBase.cs TaskLoading.ContinueWith( t => { if (t.Exception != null) log("Canceled with error: " + t.Exception.GetBaseException().Message); else log("Canceled"); }) Link To Source File
RuElect KartaitogovViewModel.cs Task.Factory.StartNew( () => { IsLoading = true; Repository.Initialize(); bool isNewProvider; string providerName = String.IsNullOrWhiteSpace(ProviderName) ? DefaultProviderName : ProviderName; ResultProvider provider = Repository.GetOrCreateProvider(providerName, out isNewProvider); var poll = ensurePollCreated(); provider.Poll = poll; if (Tcs.IsCancellationRequested) return; string pageContent = downloadMainPage(); if (Tcs.IsCancellationRequested) return; IDictionary imageFilesMap = parseAndDownloadImages(pageContent); var loader = new KartaitogovWebLoader(pageContent, imageFilesMap, Logger); loadProtocols(loader, provider, isNewProvider); }).ContinueWith( (t) => { IsLoading = false; LastError = t.Exception != null ? t.Exception.InnerException : null; if (t.Exception != null) log(t.Exception.GetBaseException().ToString()); }) Link To Source File
RuElect KartaitogovViewModel.cs Task.Factory.StartNew( () => { if (String.IsNullOrEmpty(ImagesFolder)) { log("You should specify folder for protocol images"); return; } IsLoading = true; string pageContent = downloadMainPage(); if (Tcs.IsCancellationRequested) return; parseAndDownloadImages(pageContent); }) .ContinueWith(tearDown) Link To Source File
Filechronization ConnectionManager.cs Task.Factory.StartNew(Read).ContinueWith(ant => { _exception = ant.Exception; // In case an exception occurred. if (_stream != null) try { _stream.Close(); } catch (Exception ex) { _exception = ex; } ; _waitHandle.Set(); if (callback != null) callback(this); }) Link To Source File
Filechronization AsyncConnection.cs Task.Factory.StartNew(ScheduleStreamRead) .ContinueWith(prev=> { _exception = prev.Exception; FireCallback(); }) Link To Source File
MvcPerf RazorEditorParser.cs Task.ContinueWith(t => { Interlocked.Decrement(ref _activeTaskCount); CancelSource.Dispose(); t.Dispose(); }) Link To Source File
Bargains WowheadIconDownloader.cs task.ContinueWith(c => iconStream.Close()) Link To Source File
Bargains WowheadIconDownloader.cs task.ContinueWith(c => iconStream.Close()) Link To Source File
conduit FanucSocket.cs // If data receiption completes fully, fire event and dispose operation.ContinueWith( continuationOptions: TaskContinuationOptions.ExecuteSynchronously, continuationAction: (t) => { if (t.IsCompleted && !t.IsCanceled) { if (ReceiveOperationCompleted != null) ReceiveOperationCompleted.Invoke(this, null); } else if (t.IsFaulted) { if (ExceptionOccurred != null) ExceptionOccurred.Invoke(this, t.Exception); } cancelSource.Dispose(); cancelSource = null; operation.Dispose(); operation = null; ChangeState(FanucSocketState.Idle); } ) Link To Source File
conduit FanucSocket.cs // If sending completes fully, fire event and dispose operation.ContinueWith( continuationOptions: TaskContinuationOptions.ExecuteSynchronously, continuationAction: (t) => { if (t.IsCompleted && !t.IsCanceled) { if (SendOperationCompleted != null) SendOperationCompleted.Invoke(this, null); } else if (t.IsFaulted) { if (ExceptionOccurred != null) ExceptionOccurred.Invoke(this, t.Exception); } cancelSource.Dispose(); cancelSource = null; operation.Dispose(); operation = null; ChangeState(FanucSocketState.Idle); } ) Link To Source File
NicoCacheDriver NicoCacheDriverForm.cs loadSettingsTask.ContinueWith(_ => { if (settingsLoaded) { SetAllControlEnabledStatus(true); interceptButton.Enabled = false; cancelDLButton.Enabled = false; Text = "NicoCacheDriver"; } else { Text = "NicoCacheDriver (Loading settings failed!)"; splitContainer1.Enabled = true; splitContainer1.Panel2.Enabled = true; exitButton.Enabled = true; } bool timeEnabled; if (!smng.TryGetItem(SettingsConstants.TIME_ENABLED, out timeEnabled)) { timeEnabled = false; } downloadableTimeEnabled.Checked = timeEnabled; DateTime start; if (smng.TryGetItem(SettingsConstants.START, out start)) { downloadableTimeStart.Value = start; } DateTime end; if (smng.TryGetItem(SettingsConstants.END, out end)) { downloadableTimeEnd.Value = end; } string logFile; if (smng.TryGetItem(SettingsConstants.LOG_FILE, out logFile)) { logWriter.Dispose(); Stream logStream = File.Open(logFile, FileMode.Append, FileAccess.Write, FileShare.ReadWrite); logWriter = new StreamWriter(logStream, new UTF8Encoding()); } bool autoStart; if (!smng.TryGetItem(SettingsConstants.AUTO_START, out autoStart)) { autoStart = false; } if (autoStart) { pollingTimer.Start(); onlineController.Checked = true; onlineController.Text = "Online"; } else { onlineController.Checked = false; onlineController.Text = "Offline"; } queueingUrls.Focus(); }, TaskScheduler.FromCurrentSynchronizationContext()) Link To Source File
ILSpy ThreadingSupport.cs thisTask.ContinueWith( delegate (Task continuation) { App.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action( delegate { if (loadChildrenTask == thisTask) { node.Children.RemoveAt(node.Children.Count - 1); // remove 'Loading...' } if (continuation.Exception != null) { // observe exception even when task isn't current if (loadChildrenTask == thisTask) { foreach (Exception ex in continuation.Exception.InnerExceptions) { node.Children.Add(new ErrorTreeNode(ex.ToString())); } } } })); }) Link To Source File
SharpDevelop SearchManager.cs task.ContinueWith( t => { LoggingService.Debug("Parallel FindAll finished " + (t.IsFaulted ? "with error" : "successfully")); if (t.Exception != null) observer.OnError(t.Exception); else observer.OnCompleted(); this.Dispose(); }) Link To Source File
LessonsLearned VerifyPersonActivity.cs Task.Factory.StartNew(() => Persist(input, accept)).ContinueWith(r => RaiseFinished(accept)) Link To Source File
Mystique TweetStorage.cs Task.Factory.StartNew(() => RaiseStatusAdded(viewModel)).ContinueWith(_ => { // delay add using (vmLockWrap.GetWriterLock()) { viewmodels.Add(viewModel); } }) Link To Source File
Bricks Server.cs sleeper.ContinueWith(task => { this.IsPaused = false; _unpauseEvent.Set(); //notify waiting Task that we have unpaused }) Link To Source File
lokad-cloud CloudEnvironment.cs // TODO (ruegg, 2011-05-30): Replace with system events task.ContinueWith(t => { try { if (t.IsFaulted) { HttpStatusCode httpStatus; if (ProvisioningErrorHandling.TryGetHttpStatusCode(t.Exception, out httpStatus)) { switch (httpStatus) { case HttpStatusCode.Conflict: _log.DebugFormat("Provisioning: Updating the worker instance count to {0} failed because another deployment update is already in progress.", count); break; default: _log.DebugFormat("Provisioning: Updating the worker instance count failed with HTTP Status {0} ({1}).", httpStatus, (int)httpStatus); break; } } else if (ProvisioningErrorHandling.IsTransientError(t.Exception)) { _log.DebugFormat(task.Exception.GetBaseException(), "Provisioning: Updating the worker instance count failed with a transient error."); } else { _log.WarnFormat(task.Exception.GetBaseException(), "Provisioning: Updating the worker instance count failed with a permanent error."); } } } catch (Exception) { // We don't really care, it's only logging that failed } }, TaskContinuationOptions.ExecuteSynchronously) Link To Source File
lokad-cqrs DomainLogView.cs start.ContinueWith(t => { var list = new List(); long maxCount; if (!Int64.TryParse(txtCount.Text, out maxCount)) { maxCount = MaxCount; } MaxCount = (int) maxCount; _client.ObserveTill(maxVersion, (int) maxCount, s => { var envelope = _serializer.ReadAsEnvelopeData(s.Data); for (int i = 0; i < envelope.Items.Length; i++) { var item = envelope.Items[i]; var session = DomainAwareAnalysis.GetCategoryNames(item); // clone batch envelopes into separate ones var clone = EnvelopeBuilder.CloneProperties(envelope.EnvelopeId + "-" + i, envelope); clone.AddItem(item.Content); list.Add(new DomainLogDisplayItem(clone.Build(), session, s.Version)); } }); return list; }) Link To Source File
Channel9Downloader CategoriesVM.cs task.ContinueWith(x => InitializeCategoriesAsync(continuationTaskScheduler)) Link To Source File
Channel9Downloader DashboardVM.cs task.ContinueWith( x => { LatestVideos = new ObservableCollection(latestVideos); IsAdornerVisible = false; CommandManager.InvalidateRequerySuggested(); }, continuationTaskScheduler) Link To Source File
Simple.Data BufferedEnumerable.cs task.ContinueWith(t => cleanup()) Link To Source File
YUV.KA PipelineDriver.cs lastTask .ContinueWith(_ => { // producer/consumer scenario: ticks holds all currently executing tasks // consumer also holds one -> maximum of parallel ticks // except when there's only one core and we'd allocate an empty collection, let's just use 2 cores var ticks = new BlockingCollection>>(Math.Max(1, Environment.ProcessorCount - 1)); Task.Factory.StartNew(() => { for (int tick = startTick; tickCount == null || tick < startTick + tickCount; tick++) { // use lazy to only start the task after adding it var task = new Lazy>(() => RenderTickCore(startNodes.Distinct(), tick, tokenSource.Token)); ticks.Add(task, tokenSource.Token); new Func(() => task.Value)(); // force evaluation } }, tokenSource.Token, TaskCreationOptions.AttachedToParent, TaskScheduler.Current) .ContinueWith(__ => ticks.CompleteAdding()); try { foreach (Lazy> tick in ticks.GetConsumingEnumerable()) observer.OnNext(tick.Value.Result); } finally { tokenSource.Cancel(); // Cancel producer } }, tokenSource.Token) Link To Source File
YUV.KA PipelineDriver.cs Task.Factory.StartNew(() => { for (int tick = startTick; tickCount == null || tick < startTick + tickCount; tick++) { // use lazy to only start the task after adding it var task = new Lazy>(() => RenderTickCore(startNodes.Distinct(), tick, tokenSource.Token)); ticks.Add(task, tokenSource.Token); new Func(() => task.Value)(); // force evaluation } }, tokenSource.Token, TaskCreationOptions.AttachedToParent, TaskScheduler.Current) .ContinueWith(__ => ticks.CompleteAdding()) Link To Source File
nuget PackageRestoreBar.xaml.cs _packageRestoreManager.RestoreMissingPackages().ContinueWith( task => { if (task.IsFaulted) { // re-enable the Restore button to allow users to try again RestoreButton.IsEnabled = true; StatusMessage.Text = VsResources.PackageRestoreErrorTryAgain; } }, uiScheduler) Link To Source File
SwarmIntelligence MainWindow.xaml.cs Task.Factory .StartNew(model.Turn) .ContinueWith(_ => { nextStep.IsEnabled = true; }, uiContextScheduler) Link To Source File
SwarmIntelligence MainWindow.xaml.cs Task.Factory .StartNew(model.Initialize) .ContinueWith(_ => { nextStep.IsEnabled = true; }, uiContextScheduler) Link To Source File
NugetCracker PackageRestoreBar.xaml.cs _packageRestoreManager.RestoreMissingPackages().ContinueWith( task => { if (task.IsFaulted) { // re-enable the Restore button to allow users to try again RestoreButton.IsEnabled = true; StatusMessage.Text = VsResources.PackageRestoreErrorTryAgain; } }, uiScheduler) Link To Source File
NecroNetToolkit MailBot.cs Task.Factory.StartNew(() => SmtpClient.Send(message)).ContinueWith(t => { _queuedMails--; RaiseSendingCompleted(!t.IsFaulted, message.To, message.Subject, message.Body, t.Exception); message.Dispose(); CheckDispose(); }) Link To Source File
WebBackgrounder WebFarmJobCoordinator.cs task.ContinueWith(c => { if (c.IsFaulted) { unitOfWork.Fail(c.Exception.GetBaseException()); } else { unitOfWork.Complete(); } }) Link To Source File
ODataLib ODataBatchWriter.cs this.FlushAsynchronously() .ContinueWith( t => { // TODO, ckerer: if we use TaskContinuationOptions.OnlyOnFaulted instead of this check, // we always get a TaskCanceledException and it is unclear where it is thrown; review. if (t.IsFaulted) { this.SetState(BatchWriterState.FatalExceptionThrown); // to avoid nested aggregate exceptions only because we changed the internal state // we re-throw the inner exception if there is only one. Otherwise we have to live // with the nesting. throw t.Exception.InnerExceptions.Count == 1 ? t.Exception.InnerException : t.Exception; } }) Link To Source File
ODataLib ODataCollectionWriterCore.cs this.FlushAsynchronously() .ContinueWith( t => { // TODO, ckerer: if we use TaskContinuationOptions.OnlyOnFaulted instead of this check, // we always get a TaskCanceledException and it is unclear where it is thrown; review. if (t.IsFaulted) { this.ReplaceScope(CollectionWriterState.FatalExceptionThrown, null); // to avoid nested aggregate exceptions only because we changed the internal state // we re-throw the inner exception if there is only one. Otherwise we have to live // with the nesting. throw t.Exception.InnerExceptions.Count == 1 ? t.Exception.InnerException : t.Exception; } }) Link To Source File
ODataLib ODataWriterCore.cs this.FlushAsynchronously() .ContinueWith( t => { // TODO, ckerer: if we use TaskContinuationOptions.OnlyOnFaulted instead of this check, // we always get a TaskCanceledException and it is unclear where it is thrown; review. if (t.IsFaulted) { this.ReplaceScope(WriterState.FatalExceptionThrown, null); // to avoid nested aggregate exceptions only because we changed the internal state // we re-throw the inner exception if there is only one. Otherwise we have to live // with the nesting. throw t.Exception.InnerExceptions.Count == 1 ? t.Exception.InnerException : t.Exception; } }) Link To Source File
ODataLib TaskUtils.cs // The IgnoreException here is effective only for the recursiveBody code // (not the nextTask, which is being checked by the recursiveBody above). // And since the recursiveBody already catches all exceptions except for the uncatchable // ones, we think it's OK to ignore all those exception in the finalizer thread. nextTask.ContinueWith(recursiveBody) Link To Source File
MXML2MuseScore MainWindowViewModel.cs task.ContinueWith(resultTask => { IsBusy = false; }) Link To Source File
MXML2MuseScore MainWindowViewModel.cs task.ContinueWith(resultTask => { IsBusy = false; dispatcher.Invoke(() => _historyService.Add(_currentDocument)); }) Link To Source File
OG-DotNet ParallelCommandGroup.cs next.ContinueWith(t => StartOne(taskQueue)) Link To Source File
OG-DotNet FutureControl.xaml.cs dataContext.ContinueWith(t => { Dispatcher.BeginInvoke((Action)delegate { if (Interlocked.Read(ref _taskId) != taskId) return; object result; if (t.Exception != null) { result = null; ErrorVisibility = Visibility.Visible; string detailMessage; ErrorText = GetErrorText(t.Exception, out detailMessage); ErrorDetailText = detailMessage; } else { ErrorVisibility = Visibility.Hidden; result = t.GetType().GetProperty("Result").GetGetMethod().Invoke(dataContext, new object[] { }); } content.DataContext = result; content.IsEnabled = true; LoadingVisibility = Visibility.Hidden; }); } ) Link To Source File
Automapper MultiThreadingIssues.cs Task.Factory.StartNew( doMapping ).ContinueWith( a => { if (Interlocked.Increment(ref _done) == threadCount) { _allDone.Set( ) ; } } ) Link To Source File
Dominion Simulation.cs Task.Factory.StartNew(() => RunGame(temp, startingConfig)) .ContinueWith(t => CreateSummary()) Link To Source File
nji NjiApi.cs DownloadAsync(package, TempDir, packageFilename, cancellationToken) .ContinueWith(downloadTask => { if (downloadTask.IsFaulted) throw downloadTask.Exception.GetBaseException(); var downloadFilePath = downloadTask.Result; return Extract(downloadFilePath, destinationDir); }).Unwrap() .ContinueWith(extractTask => { if (extractTask.IsFaulted) throw extractTask.Exception.GetBaseException(); var packageExtractedDir = Directory.GetDirectories(destinationDir)[0]; string packageJson = Path.Combine(packageExtractedDir, "package.json"); dynamic metadata = null; if (File.Exists(Path.Combine(packageJson))) { metadata = SimpleJson.DeserializeObject(File.ReadAllText(packageJson)); if (metadata.ContainsKey("name")) packageName = metadata.name; } var moduleFinalDir = Path.Combine(WorkingDirectory, "node_modules", packageName); CleanDir(moduleFinalDir); Directory.Move(Directory.GetDirectories(destinationDir)[0], moduleFinalDir); if (Verbose > 0) Out.WriteLine("Successfully installed {0} in {1}", packageName, moduleFinalDir); return InstallDependencies((object)metadata, cancellationToken, installDependencies); }) Link To Source File
kudu TaskExtensions.cs task.ContinueWith(t => { if (t.IsFaulted) { tcs.SetException(t.Exception); } else if (t.IsCanceled) { tcs.SetCanceled(); } else { try { successor(); tcs.SetResult(null); } catch (Exception ex) { tcs.SetException(ex); } } }) Link To Source File
preprompt-parallel AsyncEnumerator.cs current.ContinueWith(cont) Link To Source File
ravendb AsyncServerClient.cs Task.Factory.FromAsync(httpJsonRequest.BeginWrite, httpJsonRequest.EndWrite, postedData, null) .ContinueWith( task => { task.Wait();// will throw on error return httpJsonRequest.ReadResponseJsonAsync() .ContinueWith(replyTask => { var responses = convention.CreateSerializer().Deserialize(new RavenJTokenReader(replyTask.Result)); return multiGetOperation.HandleCachingResponse(responses, jsonRequestFactory); }) ; }) Link To Source File
ravendb ReplicationInformer.cs Task.Factory.StartNew(() => RefreshReplicationInformation(serverClient)) .ContinueWith(task => { if (task.Exception != null) { log.ErrorException("Failed to refresh replication information", task.Exception); } refreshReplicationInformationTask = null; }) Link To Source File
ravendb HttpJsonRequest.cs WaitForTask.ContinueWith(_ => webRequest.GetRequestStreamAsync().ContinueWith(t => { var dataStream = t.Result; using (dataStream) { dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); } })) Link To Source File
ravendb DocumentDatabase.cs System.Threading.Tasks.Task.Factory.FromAsync(transaction.BeginCommit, transaction.EndCommit, null) .ContinueWith(task => { if (task.Exception != null) log.WarnException("Could not commit dtc transaction", task.Exception); try { transaction.Dispose(); } catch (Exception e) { log.WarnException("Could not dispose of dtc transaction", e); } }) Link To Source File
ravendb InvocationExtensions.cs task.ContinueWith(t => action()) Link To Source File
ravendb InvocationExtensions.cs Execute.OnTheUI(() => ErrorPresenter.Show(ex, stackTrace)) .ContinueWith(_ => action(task.Exception)) Link To Source File
ravendb InvocationExtensions.cs parent.ContinueWith(task => { if (task.IsFaulted == false) return; var ex = task.Exception.ExtractSingleInnerException(); Execute.OnTheUI(() => ErrorPresenter.Show(ex, stackTrace)) .ContinueWith(_ => action(task.Exception)); }) Link To Source File
ravendb InvocationExtensions.cs Execute.OnTheUI(() => ErrorPresenter.Show(ex, stackTrace)) .ContinueWith(_ => action(task.Exception)) Link To Source File
ravendb InvocationExtensions.cs parent.ContinueWith(task => { if (task.IsFaulted == false) return task; var ex = task.Exception.ExtractSingleInnerException() as TException; if (ex == null) return task; Execute.OnTheUI(() => action(ex)); return Execute.EmptyResult(); }) Link To Source File
ravenmq ClientConnection.cs Task.Factory.FromAsync(socket.BeginConnect, socket.EndConnect, endpoint, null) .ContinueWith(task => { if (task.Exception != null) return task; return socket.Write(RequestHandshakeSignature.ToByteArray()) .IgnoreExceptions() .ContinueWith(writeResult => socket.ReadBuffer(16) .ContinueWith(AssertValidServerResponse) .ContinueWith(connectionTask => { if (connectionTask.Exception != null) return connectionTask; StartReceiving(); connected = true; return connectionTask; })) .Unwrap() .Unwrap(); }) Link To Source File
ravenmq RavenMQConnection.cs connectToServerTask.ContinueWith(task => { if (task.Exception != null) return task; return clientConnection.Send(JObject.FromObject(new ChangeSubscriptionMessage { Type = type, Queues = { queue } })); }) Link To Source File
ravenmq RavenMQConnection.cs TaskEx.Delay(TimeSpan.FromSeconds(3)) .ContinueWith(_ => TryReconnecting()) Link To Source File
Golf GameEngine.cs Task.Factory.StartNew(RunShotToCompletion).ContinueWith(t => _eventTriggerer.Trigger(new ShotComplete())) Link To Source File
PROMPT11-07-ConcurrentProgramming.sandrapatfer AsyncEnumerator.cs current.ContinueWith(cont) Link To Source File
PROMPT11-07-ConcurrentProgramming.sandrapatfer FileFinderForm.cs mainTask.ContinueWith((t) => { ctx.Post((o) => { txtResults.AddLine(string.Format("Number of files: {0}", nFiles)); btnCancel.Enabled = false; btnSearch.Enabled = true; }, null); }/*, sch*/) Link To Source File
PROMPT11-07-ConcurrentProgramming.sandrapatfer MoviesAsyncController_old.cs detailsTask.ContinueWith(task => { AsyncManager.Parameters["result"] = info; AsyncManager.OutstandingOperations.Decrement(); }) Link To Source File
PROMPT11-07-ConcurrentProgramming.sandrapatfer AsyncEnumerator.cs current.ContinueWith(cont) Link To Source File
PROMPT11-07-ConcurrentProgramming.sandrapatfer TaskUtils.cs task.ContinueWith((t) => { // TODO, deal with errors if (Interlocked.Decrement(ref nTasks) == 0) { cts.TrySetResult(true); } /* else (t.Status == TaskStatus.RanToCompletion) { cts.TrySetException(new Exception("None completed")); }*/ }) Link To Source File
yessql Session.cs Task.Factory.StartNew(() => { Reduce(); _transaction.Commit(); }).ContinueWith(task => Dispose()) Link To Source File
Roger With_rabbitmq_broker.cs Task.Factory.StartNew(function, tokenSource.Token).ContinueWith(t => { if (t.IsFaulted) throw t.Exception; }) Link To Source File
Merchant-Editor ItemRow.xaml.cs startHide.ContinueWith(task => btRemove.Visibility = Visibility.Collapsed, _sheduler) Link To Source File
sones IncomingEdgeSorter.cs sortTask.ContinueWith(_ => location.Store(_chunks[location], filename)) Link To Source File
ScoobyRom MainWindow.cs // Exceptions must be handled in Task task.ContinueWith (t => LoadRomDone (t)) Link To Source File
talifun-commander ExecuteBoxNetUploaderWorkflowMessageHandlerBase.cs task.ContinueWith((t) => { BoxNetUploaderService.Uploaders.Add(message, new CancellableTask { Task = task, CancellationTokenSource = cancellationTokenSource }); var configuration = GetBoxNetConfiguration(); var storage = new CloudStorage(); var accessToken = storage.Open(configuration, authenticationToken); var folder = string.IsNullOrEmpty(message.Settings.Folder) ? storage.GetRoot() : storage.GetFolder(message.Settings.Folder); if (folder == null) { throw new Exception(string.Format("Folder does not exist - {0}", message.Settings.Folder)); } else { var file = storage.CreateFile(folder, inputFilePath.Name); var uploader = file.GetDataTransferAccessor(); using (var inputFileStream = inputFilePath.OpenRead()) { uploader.Transfer(inputFileStream, nTransferDirection.nUpload, FileOperationProgressChanged, task); } } if (storage.IsOpened) { storage.Close(); } } , cancellationToken) Link To Source File
talifun-commander ExecuteDropBoxUploaderWorkflowMessageHandlerBase.cs task.ContinueWith((t) => { DropBoxUploaderService.Uploaders.Add(message, new CancellableTask { Task = task, CancellationTokenSource = cancellationTokenSource }); var configuration = GetDropBoxConfiguration(); var storage = new CloudStorage(); storage.Open(configuration, authenticationToken); var folder = string.IsNullOrEmpty(message.Settings.Folder) ? storage.GetRoot() : storage.GetFolder(message.Settings.Folder); if (folder == null) { throw new Exception(string.Format("Folder does not exist - {0}", message.Settings.Folder)); } else { var file = storage.CreateFile(folder, inputFilePath.Name); var uploader = file.GetDataTransferAccessor(); using (var inputFileStream = inputFilePath.OpenRead()) { uploader.Transfer(inputFileStream, nTransferDirection.nUpload, FileOperationProgressChanged, task); } } if (storage.IsOpened) { storage.Close(); } } , cancellationToken) Link To Source File
talifun-commander ExecuteFlickrUploaderWorkflowMessageHandlerBase.cs task.ContinueWith((t) => { if (!cancellationToken.IsCancellationRequested) { FlickrUploaderService.Uploaders.Add(message, new CancellableTask { Task = task, CancellationTokenSource = cancellationTokenSource }); var uploader = new Uploader(flickrAuthenticator); uploader.AsyncOperationCompleted += OnResumableUploaderAsyncOperationCompleted; uploader.AsyncOperationProgress += OnResumableUploaderAsyncOperationProgress; var asyncUploadSettings = new AsyncUploadSettings() { Message = message, InputStream = inputFilePath.OpenRead() }; cancellationToken.Register(() => uploader.CancelAsync(message)); uploader.UploadPictureAsync(asyncUploadSettings.InputStream, inputFilePath.Name, message.Settings.MetaData.Title, message.Settings.MetaData.Description, message.Settings.MetaData.Keywords, message.Settings.MetaData.IsPublic, message.Settings.MetaData.IsFamily, message.Settings.MetaData.IsFriend, message.Settings.MetaData.ContentType, message.Settings.MetaData.SafetyLevel, message.Settings.MetaData.HiddenFromSearch, asyncUploadSettings); } cancellationToken.ThrowIfCancellationRequested(); } , cancellationToken) Link To Source File
talifun-commander ExecutePicasaUploaderWorkflowMessageHandlerBase.cs task.ContinueWith((t) => { if (!cancellationToken.IsCancellationRequested) { PicasaUploaderService.Uploaders.Add(message, new CancellableTask { Task = task, CancellationTokenSource = cancellationTokenSource }); var resumableUploader = new ResumableUploader(message.Settings.Upload.ChunkSize); resumableUploader.AsyncOperationCompleted += OnResumableUploaderAsyncOperationCompleted; resumableUploader.AsyncOperationProgress += OnResumableUploaderAsyncOperationProgress; cancellationToken.Register(() => resumableUploader.CancelAsync(message)); resumableUploader.InsertAsync(picasaAuthenticator, picasaEntry, message); } cancellationToken.ThrowIfCancellationRequested(); } , cancellationToken) Link To Source File
talifun-commander ExecuteYouTubeUploaderWorkflowMessageHandlerBase.cs task.ContinueWith((t) => { if (!cancellationToken.IsCancellationRequested) { YouTubeUploaderService.Uploaders.Add(message, new CancellableTask { Task = task, CancellationTokenSource = cancellationTokenSource }); var resumableUploader = new ResumableUploader(message.Settings.Upload.ChunkSize); resumableUploader.AsyncOperationCompleted += OnResumableUploaderAsyncOperationCompleted; resumableUploader.AsyncOperationProgress += OnResumableUploaderAsyncOperationProgress; cancellationToken.Register(() => resumableUploader.CancelAsync(message)); resumableUploader.InsertAsync(youTubeAuthenticator, youTubeEntry, message); } cancellationToken.ThrowIfCancellationRequested(); } , cancellationToken) Link To Source File
twdc RazorEditorParser.cs Task.ContinueWith(t => { Interlocked.Decrement(ref _activeTaskCount); CancelSource.Dispose(); t.Dispose(); }) Link To Source File
Rob.DataDemo frmDataTransfer.cs currentTask.ContinueWith(task => { cleanUp(task); }) Link To Source File
Medicine-Aggregator AggregatorService.cs aggTask.ContinueWith(ant => { AggregateException aggEx = ant.Exception; foreach (Exception ex in aggEx.InnerExceptions) { if (ex is OperationCanceledException) { AggregationCanceled(); break; } } }, TaskContinuationOptions.OnlyOnFaulted) Link To Source File
WCell TaskExtensions.cs task.ContinueWith(_ => { tcs.SetFromTask(task); if (callback != null) callback(tcs.Task); }) Link To Source File
WCell TaskFactoryExtensions.cs nextTask.ContinueWith(recursiveBody) Link To Source File
cs160 KinectSettings.xaml.cs Task.Factory.StartNew( () => { try { // Check for not null and running if ((this.Kinect != null) && this.Kinect.IsRunning) { // We must wait at least 1 second, and call no more frequently than 15 times every 20 seconds // So, we wait at least 1350ms afterwards before we set backgroundUpdateInProgress to false. this.Kinect.ElevationAngle = angleToSet; this.lastSetSensorAngle = angleToSet; Thread.Sleep(1350); } } finally { this.backgroundUpdateInProgress = false; } }).ContinueWith( results => { // This can happen if the Kinect transitions from Running to not running // after the check above but before setting the ElevationAngle. if (results.IsFaulted) { var exception = results.Exception; Debug.WriteLine( "Set Elevation Task failed with exception " + exception); } }) Link To Source File
Robot-Sorter-Deluxe ScorBotScript.cs task.ContinueWith(t => ContinueCallback(t.Exception, callback)) Link To Source File
Robot-Sorter-Deluxe ScorBotScript.cs task.ContinueWith(t => ContinueCallback(t.Exception, callback)) Link To Source File
Robot-Sorter-Deluxe ScorBotScript.cs task.ContinueWith(t => ContinueCallback(t.Exception, callback)) Link To Source File
Robot-Sorter-Deluxe ScorBotScript.cs task.ContinueWith(t => ContinueCallback(t.Exception, callback)) Link To Source File
monotouch-samples RootViewController.cs DownloadTask.ContinueWith (prevTask => { try { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; using (var c = new GzipWebClient ()) data = c.DownloadData (app.ImageUrl); } finally { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; } }) Link To Source File
monotouch-samples RootViewController.cs DownloadTask.ContinueWith (t => { // Load the image from the byte array. app.Image = UIImage.LoadFromData (NSData.FromArray (data)); // Retrieve the cell which corresponds to the current App. If the cell is null, it means the user // has already scrolled that app off-screen. var cell = Controller.TableView.VisibleCells.Where (c => c.Tag == Controller.Apps.IndexOf (app)).FirstOrDefault (); if (cell != null) cell.ImageView.Image = app.Image; }, CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.FromCurrentSynchronizationContext ()) Link To Source File
RI-Project MainForm.cs Task.Factory.StartNew(() => { stats.Proceed(openFileDialog1.FileName); }).ContinueWith(_ => { stats.Proceedltn(); stats.ProceedBM25_TF(); WriteToFile("2009011"); stats.clean_n_clear(); stats.requests.Clear(); stats.requests.Add("notting"); stats.requests.Add("hill"); stats.requests.Add("film"); stats.requests.Add("actors"); stats.Proceedltn(); stats.ProceedBM25_TF(); WriteToFile("2009036"); stats.clean_n_clear(); stats.requests.Clear(); stats.requests.Add("probabilistic"); stats.requests.Add("models"); stats.requests.Add("in"); stats.requests.Add("information"); stats.requests.Add("retrieval"); stats.Proceedltn(); stats.ProceedBM25_TF(); WriteToFile("2009067"); stats.clean_n_clear(); stats.requests.Clear(); stats.requests.Add("web"); stats.requests.Add("link"); stats.requests.Add("network"); stats.requests.Add("analysis"); stats.Proceedltn(); stats.ProceedBM25_TF(); WriteToFile("2009073"); stats.clean_n_clear(); stats.requests.Clear(); stats.requests.Add("web"); stats.requests.Add("ranking"); stats.requests.Add("scoring"); stats.requests.Add("algorithm"); stats.Proceedltn(); stats.ProceedBM25_TF(); WriteToFile("2009074"); stats.clean_n_clear(); stats.requests.Clear(); stats.requests.Add("supervised"); stats.requests.Add("machine"); stats.requests.Add("learning"); stats.requests.Add("algorithm"); stats.Proceedltn(); stats.ProceedBM25_TF(); WriteToFile("2009078"); stats.clean_n_clear(); stats.requests.Clear(); stats.requests.Add("operating"); stats.requests.Add("system"); stats.requests.Add("+mutual"); stats.requests.Add("+exclusion"); stats.Proceedltn(); stats.ProceedBM25_TF(); WriteToFile("2009085"); }) Link To Source File
RI-Project MainForm.cs Task.Factory.StartNew(() => { statsXML.Proceed(dlg.SelectedPath, 200); statsXML.B = 0.5; statsXML.K = 1; }).ContinueWith(_ => { statsXML.requests.Clear(); statsXML.requests.Add("olive"); statsXML.requests.Add("oil"); statsXML.requests.Add("health"); statsXML.requests.Add("benefit"); statsXML.Proceedltn(); statsXML.ProceedBM25_TF(); WriteToFileXML("2009011"); }) Link To Source File
msgpack-rpc-cli Dispatcher.cs // FIXME: Execution timeout #if NET_4_5 task.ContinueWith( ( previous, state ) => { var tuple = state as Tuple; SendResponse( previous, tuple.Item1, tuple.Item2, tuple.Item3 ) }, Tuple.Create( serverTransport, responseContext, sessionState ) ).ContinueWith( ( previous, state ) => { HandleSendFailure( previous, state as Tuple ); }, TaskContinuationOptions.OnlyOnFaulted, sessionState ); #else task.ContinueWith( previous => { SendResponse( previous, serverTransport, responseContext, sessionState ); } ) Link To Source File
msgpack-rpc-cli AsyncServiceInvoker`1.cs task.ContinueWith( previous => HandleInvocationResult( previous, tuple ) ) Link To Source File