Esempio n. 1
0
        /// <summary>
        /// Resolve task safe
        /// </summary>
        private void InitNextTask()
        {
            //try get next task
            try
            {
                IPandaTask continuationPandaTask = _nextActionDelegate();

                //no task resolved
                if (continuationPandaTask != null)
                {
                    _state = ContinuationTaskState.WaitSecondComplete;
                    continuationPandaTask.Done(HandleTaskCompleted).Fail(HandleTaskFailed);
                }
                else
                {
                    RejectInternal(new NullReferenceException(@"Continuation callback returns null task!"));
                }
            }
            catch (Exception ex)
            {
                if (Status != PandaTaskStatus.Pending)
                {
                    throw;
                }

                //reject on non system exceptions
                RejectInternal(ex);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Reject Task with state change
 /// </summary>
 /// <param name="exception">reject exception</param>
 private void RejectInternal(Exception exception)
 {
     _state = ContinuationTaskState.Completed;
     Reject(exception);
 }
Esempio n. 3
0
 public override void Dispose()
 {
     //to prevent supported state after dispose
     _state = ContinuationTaskState.Completed;
     base.Dispose();
 }
Esempio n. 4
0
 /// <summary>
 /// Set task resolved
 /// </summary>
 private void ResolveInternal()
 {
     //if continuation task completed
     _state = ContinuationTaskState.Completed;
     base.Resolve();
 }