annotate Implab/ICancelationToken.cs @ 144:8c0b95069066 v2

DRAFT: refactoring
author cin
date Fri, 06 Mar 2015 15:45:26 +0300
parents 16f926ee499d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
143
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
1 using System;
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
2
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
3 namespace Implab {
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
4 public interface ICancelationToken {
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
5 /// <summary>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
6 /// Indicates wherther the cancellation was requested.
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
7 /// </summary>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
8 bool IsCancelRequested { get ; }
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
9
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
10 /// <summary>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
11 /// The reason why the operation should be cancelled.
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
12 /// </summary>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
13 Exception CancelReason { get ; }
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
14
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
15 /// <summary>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
16 /// Accepts if requested.
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
17 /// </summary>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
18 /// <returns><c>true</c>, if if requested was accepted, <c>false</c> otherwise.</returns>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
19 bool AcceptIfRequested();
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
20
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
21 /// <summary>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
22 /// Sets the token to cancelled state.
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
23 /// </summary>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
24 /// <param name="reason">The reason why the operation was cancelled.</param>
144
8c0b95069066 DRAFT: refactoring
cin
parents: 143
diff changeset
25 void CancelOperation(Exception reason);
143
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
26
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
27 /// <summary>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
28 /// Adds the listener for the cancellation request, is the cancellation was requested the <paramref name="handler"/>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
29 /// is executed immediatelly.
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
30 /// </summary>
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
31 /// <param name="handler">The handler which will be executed if the cancel occurs.</param>
144
8c0b95069066 DRAFT: refactoring
cin
parents: 143
diff changeset
32 void CancelationRequested(Action<Exception> handler);
143
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
33
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
34 }
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
35 }
16f926ee499d DRAFT: refactoring, adding cancelation token
cin
parents:
diff changeset
36