annotate Implab.Fx/ControlBoundPromise.cs @ 102:b4c4d65b7def v2

code cleaunp
author cin
date Fri, 07 Nov 2014 09:36:12 +0300
parents d67b95eddaf4
children d4e38929ce36
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
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
22 protected override void InvokeHandler(HandlerDescriptor handler) {
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
23 if (m_target.InvokeRequired)
d67b95eddaf4 promises refactoring
cin
parents:
diff changeset
24 m_target.BeginInvoke(new Action<HandlerDescriptor>(base.InvokeHandler), handler);
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