comparison Implab/IPromise.cs @ 66:790e8a997d30

Refactoring
author cin
date Thu, 14 Aug 2014 18:08:09 +0400
parents b255e4aeef17
children c4140283575c
comparison
equal deleted inserted replaced
65:653c4e04968b 66:790e8a997d30
1 using System; 1 using System;
2 using System.Collections.Generic; 2 using System.Collections.Generic;
3 using System.Linq; 3 using System.Linq;
4 using System.Text; 4 using System.Text;
5 5
6 namespace Implab 6 namespace Implab {
7 { 7 public interface IPromise: ICancellable {
8 public interface IPromise<T>: IPromiseBase 8 /// <summary>
9 { 9 /// Check whereather the promise has no more than one dependent promise.
10 /// </summary>
11 bool IsExclusive {
12 get;
13 }
10 14
11 new T Join(); 15 /// <summary>
12 new T Join(int timeout); 16 /// Тип результата, получаемого через данное обещание.
17 /// </summary>
18 Type PromiseType { get; }
13 19
14 IPromise<T> Then(ResultHandler<T> success, ErrorHandler error); 20 bool IsResolved { get; }
15 IPromise<T> Then(ResultHandler<T> success, ErrorHandler<T> error);
16 IPromise<T> Then(ResultHandler<T> success);
17 new IPromise<T> Error(ErrorHandler error);
18 IPromise<T> Error(ErrorHandler<T> error);
19 21
20 IPromise<T2> Map<T2>(ResultMapper<T,T2> mapper, ErrorHandler error); 22 bool IsCancelled { get; }
21 IPromise<T2> Map<T2>(ResultMapper<T, T2> mapper);
22 23
23 IPromise<T2> Chain<T2>(ChainedOperation<T, T2> chained, ErrorHandler error); 24 IPromise Then(Action success,ErrorHandler error);
24 IPromise<T2> Chain<T2>(ChainedOperation<T, T2> chained); 25 IPromise Then(Action success);
26 IPromise Error(ErrorHandler error);
27 IPromise Anyway(Action handler);
28 IPromise Finally(Action handler);
29 IPromise Cancelled(Action handler);
25 30
26 new IPromise<T> Cancelled(Action handler); 31 IPromise<T> Cast<T>();
27 new IPromise<T> Finally(Action handler); 32
28 new IPromise<T> Anyway(Action handler); 33 void Join();
34 void Join(int timeout);
29 35
30 } 36 }
31 } 37 }