annotate Implab/IPromise.cs @ 11:6ec82bf68c8e promises

refactoring
author cin
date Tue, 05 Nov 2013 01:09:58 +0400
parents aa33d0bb8c0c
children eb418ba8275b
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
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
6 namespace Implab
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
7 {
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
8 public interface IPromise
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
9 {
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
10 /// <summary>
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
11 /// Check whereather the promise has no more than one dependent promise.
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
12 /// </summary>
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
13 bool IsExclusive
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
14 {
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
15 get;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
16 }
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
17
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
18 /// <summary>
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
19 /// The current state of the promise.
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
20 /// </summary>
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
21 PromiseState State
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
22 {
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
23 get;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
24 }
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
25
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
26 /// <summary>
11
6ec82bf68c8e refactoring
cin
parents: 10
diff changeset
27 /// Tries to cancel the the complete chain of promises.
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
28 /// </summary>
11
6ec82bf68c8e refactoring
cin
parents: 10
diff changeset
29 /// <returns><c>true</c> - if the promise has been cancelled, otherwise the promise will be resolved (or resolved already).</returns>
6ec82bf68c8e refactoring
cin
parents: 10
diff changeset
30 bool Cancel();
10
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents: 9
diff changeset
31
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents: 9
diff changeset
32 /// <summary>
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents: 9
diff changeset
33 /// Registers handler for the case when the promise is cencelled. If the promise already cancelled the
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents: 9
diff changeset
34 /// handler will be invoked immediatelly.
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents: 9
diff changeset
35 /// </summary>
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents: 9
diff changeset
36 /// <param name="handler">The handler</param>
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents: 9
diff changeset
37 void HandleCancelled(Action handler);
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
38 }
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
39 }