Exemplo n.º 1
0
        private void CreateRootFolderAsyncBegin(TreeNode node)
        {
            var taskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
            var task          = Task <string> .Factory.StartNew(() => DokuFlexService.CreateFolder(_ticket, _currentGroup.id, string.Empty, node.Text));

            task.ContinueWith(t => CreateFolderAsyncEnd(t.Result, node), taskScheduler);
            task.ContinueWith(t => TaskAsyncExceptionHandle(t.Exception),
                              new CancellationTokenSource().Token, TaskContinuationOptions.OnlyOnFaulted,
                              taskScheduler);
        }