72
|
1 using System.Windows.Forms;
|
|
2 using System;
|
|
3
|
|
4
|
|
5 namespace Implab.Fx {
|
|
6 public class ControlBoundPromise<T> : Promise<T> {
|
|
7 readonly Control m_target;
|
|
8
|
|
9 public ControlBoundPromise(Control target) {
|
|
10 Safe.ArgumentNotNull(target, "target");
|
|
11
|
|
12 m_target = target;
|
|
13 }
|
|
14
|
102
|
15 public ControlBoundPromise(Control target, IPromise parent)
|
|
16 : base(parent) {
|
72
|
17 Safe.ArgumentNotNull(target, "target");
|
|
18
|
|
19 m_target = target;
|
|
20 }
|
|
21
|
106
|
22 protected override void InvokeHandler(AbstractHandler handler) {
|
72
|
23 if (m_target.InvokeRequired)
|
106
|
24 m_target.BeginInvoke(new Action<AbstractHandler>(base.InvokeHandler), handler);
|
72
|
25 else
|
|
26 base.InvokeHandler(handler);
|
|
27 }
|
|
28 }
|
|
29 }
|
|
30
|