Пример #1
0
        private void DisplayProjectsAsyncBegin()
        {
            this.Cursor = Cursors.WaitCursor;

            var taskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
            var task          = Task <IList <Project> > .Factory.StartNew(() => DokuFlexService.ListProjects(_ticket, _group.id));

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