annotate Implab/IPromise.cs @ 93:dc4942d09e74 v2

improved tracing added the application components container MTComponentContainer.AppContainer
author cin
date Thu, 23 Oct 2014 01:13:57 +0400
parents c761fc982e1d
children daffa72a1cec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
1 using System;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
2 using System.Collections.Generic;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
3 using System.Linq;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
4 using System.Text;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
5
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
6 namespace Implab {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
7 public interface IPromise: ICancellable {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
8 /// <summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
9 /// Check whereather the promise has no more than one dependent promise.
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
10 /// </summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
11 bool IsExclusive {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
12 get;
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
13 }
26
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
14
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
15 /// <summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
16 /// Тип результата, получаемого через данное обещание.
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
17 /// </summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
18 Type PromiseType { get; }
25
9bf5b23650c9 refactoring
cin
parents: 19
diff changeset
19
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
20 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
21 /// Обещание является выполненым, либо успешно, либо с ошибкой.
c4140283575c minor fixes
cin
parents: 66
diff changeset
22 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
23 bool IsResolved { get; }
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
24
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
25 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
26 /// Обещание было отменено.
c4140283575c minor fixes
cin
parents: 66
diff changeset
27 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
28 bool IsCancelled { get; }
25
9bf5b23650c9 refactoring
cin
parents: 19
diff changeset
29
75
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
30 IPromise Then(Action success, ErrorHandler error, Action cancel);
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
31 IPromise Then(Action success, ErrorHandler error);
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
32 IPromise Then(Action success);
75
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
33
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
34 /// <summary>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
35 /// Добавляет последнй обработчик в цепочку обещаний, не создает промежуточных обещаний.
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
36 /// </summary>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
37 /// <param name="success">Success.</param>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
38 /// <param name="error">Error.</param>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
39 /// <param name="cancel">Cancel.</param>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
40 void Last(Action success, ErrorHandler error, Action cancel);
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
41 void Last(Action success, ErrorHandler error);
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
42 void Last(Action success);
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
43
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
44 IPromise Error(ErrorHandler error);
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
45 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
46 /// Обрабатывает либо ошибку, либо результат. Событие отмены не обрабатывается.
c4140283575c minor fixes
cin
parents: 66
diff changeset
47 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
48 /// <param name="handler">Обработчик.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
49 /// <remarks>После обработке ошибки, она передается дальше.</remarks>
c4140283575c minor fixes
cin
parents: 66
diff changeset
50 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
51 /// Обрабатывает либо ошибку, либо результат, либо отмену обещания.
c4140283575c minor fixes
cin
parents: 66
diff changeset
52 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
53 /// <param name="handler">Обработчик.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
54 /// <remarks>После обработке ошибки, она передается дальше.</remarks>
76
c761fc982e1d Refactoring of the IPromise<T> interface
cin
parents: 75
diff changeset
55 IPromise Anyway(Action handler);
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
56 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
57 /// Обработчик для регистрации отмены обещания, событие отмены не может быть подавлено.
c4140283575c minor fixes
cin
parents: 66
diff changeset
58 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
59 /// <returns>Новое обещание, связанное с текущим.</returns>
c4140283575c minor fixes
cin
parents: 66
diff changeset
60 /// <param name="handler">Обработчик события.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
61 /// <remarks>Если обработчик вызывает исключение, то оно передается обработчику ошибки, результат работы
c4140283575c minor fixes
cin
parents: 66
diff changeset
62 /// которого будет передан связанному обещанию</remarks>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
63 IPromise Cancelled(Action handler);
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
64
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
65 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
66 /// Преобразует результат обещания к заданному типу и возвращает новое обещание.
c4140283575c minor fixes
cin
parents: 66
diff changeset
67 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
68 IPromise<T> Cast<T>();
26
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
69
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
70 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
71 /// Синхронизирует текущий поток с обещанием.
c4140283575c minor fixes
cin
parents: 66
diff changeset
72 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
73 void Join();
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
74 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
75 /// Синхронизирует текущий поток с обещанием.
c4140283575c minor fixes
cin
parents: 66
diff changeset
76 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
77 /// <param name="timeout">Время ожидания, по его истечению возникнет исключение.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
78 /// <exception cref="TimeoutException">Превышено время ожидания.</exception>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
79 void Join(int timeout);
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
80
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
81 }
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
82 }