annotate Implab.Fx/ControlBoundPromise.cs @ 116:da56ba7b1aab v2

minor refactoring
author cin
date Tue, 23 Dec 2014 03:20:39 +0300
parents d4e38929ce36
children 2573b562e328
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
1 using System.Windows.Forms;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
2 using System;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
3
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
4
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
5 namespace Implab.Fx {
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
6 public class ControlBoundPromise<T> : Promise<T> {
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
7 readonly Control m_target;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
8
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
9 public ControlBoundPromise(Control target) {
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
10 Safe.ArgumentNotNull(target, "target");
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
11
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
12 m_target = target;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
13 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
14
102
b4c4d65b7def code cleaunp
cin
parents: 72
diff changeset
15 public ControlBoundPromise(Control target, IPromise parent)
b4c4d65b7def code cleaunp
cin
parents: 72
diff changeset
16 : base(parent) {
72
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
17 Safe.ArgumentNotNull(target, "target");
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
18
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
19 m_target = target;
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
20 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
21
106
d4e38929ce36 promises refactoring
cin
parents: 102
diff changeset
22 protected override void InvokeHandler(AbstractHandler handler) {
72
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
23 if (m_target.InvokeRequired)
106
d4e38929ce36 promises refactoring
cin
parents: 102
diff changeset
24 m_target.BeginInvoke(new Action<AbstractHandler>(base.InvokeHandler), handler);
72
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
25 else
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
26 base.InvokeHandler(handler);
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
27 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
28 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
29 }
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
30