private void DisplayRootsFoldersAsyncBegin() { var taskScheduler = TaskScheduler.FromCurrentSynchronizationContext(); var task = Task <IList <FileFolder> > .Factory.StartNew(() => DokuFlexService.GetFolders(_ticket, _currentGroup.id, string.Empty)); task.ContinueWith(t => DisplayRootsFoldersAsyncEnd(t.Result), taskScheduler); task.ContinueWith(t => TaskAsyncExceptionHandle(t.Exception), new CancellationTokenSource().Token, TaskContinuationOptions.OnlyOnFaulted, taskScheduler); }
private void DisplayChildsFoldersAsyncBegin(TreeNode node) { var folderId = (node.Tag as FileFolder).id; var taskScheduler = TaskScheduler.FromCurrentSynchronizationContext(); var task = Task <IList <FileFolder> > .Factory.StartNew(() => DokuFlexService.GetFolders(_ticket, _currentGroup.id, folderId)); task.ContinueWith(t => DisplayChildsFoldersAsyncEnd(t.Result, node), taskScheduler); task.ContinueWith(t => TaskAsyncExceptionHandle(t.Exception), new CancellationTokenSource().Token, TaskContinuationOptions.OnlyOnFaulted, taskScheduler); }