예제 #1
0
 /// <summary>
 /// Callback to be executed when the reported progress changes
 /// </summary>
 /// <param name="callback">Callback to be executed with the progress [0, 100] and the message</param>
 /// <returns>
 /// The current instance for chaining additional calls
 /// </returns>
 public IPromise <T> Progress(Action <int, string> callback)
 {
     if (_status == Status.Pending)
     {
         LinkedListOps.Add(ref _callback, new Callback(callback, Condition.Progress));
     }
     return(this);
 }
예제 #2
0
 IPromise IPromise.Done(Action <object> callback)
 {
     if (_status == Status.Resolved)
     {
         callback.Invoke(_arg);
     }
     else
     {
         LinkedListOps.Add(ref _callback, new Callback(callback, Condition.Success));
     }
     return(this);
 }
예제 #3
0
 /// <summary>
 /// Callback to be executed when the promise encounters an error
 /// </summary>
 /// <param name="callback">Callback to be executed with the exception of the promise</param>
 /// <returns>The current instance for chaining additional calls</returns>
 public IPromise <T> Fail(Action <Exception> callback)
 {
     if (_status == Status.Rejected)
     {
         callback.Invoke((Exception)_arg);
     }
     else
     {
         LinkedListOps.Add(ref _callback, new Callback(callback, Condition.Failure));
     }
     return(this);
 }
예제 #4
0
 /// <summary>
 /// Callback to be executed when the promise completes regardless of whether an error occurred
 /// </summary>
 /// <param name="callback">Callback to be executed</param>
 /// <returns>The current instance for chaining additional calls</returns>
 public IPromise <T> Always(Action callback)
 {
     if (_status != Status.Pending)
     {
         callback.Invoke();
     }
     else
     {
         LinkedListOps.Add(ref _callback, new Callback(callback, Condition.Always));
     }
     return(this);
 }
예제 #5
0
 internal void QuickAddAttribute(ILinkedAnnotation attr)
 {
     LinkedListOps.Add(ref _lastAttr, attr);
 }
예제 #6
0
 internal void QuickAddElement(ILinkedElement elem)
 {
     _content = LinkedListOps.Add(_content as ILinkedElement, elem);
 }