comparison Implab.Fx/ControlBoundPromise.cs @ 119:2573b562e328 v2

Promises rewritten, added improved version of AsyncQueue
author cin
date Sun, 11 Jan 2015 19:13:02 +0300
parents d4e38929ce36
children f75cfa58e3d4
comparison
equal deleted inserted replaced
118:e046a94eecb1 119:2573b562e328
10 Safe.ArgumentNotNull(target, "target"); 10 Safe.ArgumentNotNull(target, "target");
11 11
12 m_target = target; 12 m_target = target;
13 } 13 }
14 14
15 public ControlBoundPromise(Control target, IPromise parent) 15 protected override void SignalSuccess(IDeferred<T> handler) {
16 : base(parent) { 16 if (m_target.InvokeRequired)
17 Safe.ArgumentNotNull(target, "target"); 17 m_target.BeginInvoke(new Action<IDeferred<T>>(base.SignalSuccess), handler);
18 18 else
19 m_target = target; 19 base.SignalSuccess(handler);
20 } 20 }
21 21
22 protected override void InvokeHandler(AbstractHandler handler) { 22 protected override void SignalCancelled(IDeferred<T> handler) {
23 if (m_target.InvokeRequired) 23 if (m_target.InvokeRequired)
24 m_target.BeginInvoke(new Action<AbstractHandler>(base.InvokeHandler), handler); 24 m_target.BeginInvoke(new Action<IDeferred<T>>(base.SignalCancelled), handler);
25 else 25 else
26 base.InvokeHandler(handler); 26 base.SignalCancelled(handler);
27 } 27 }
28
29 protected override void SignalError(IDeferred<T> handler, Exception error) {
30 if (m_target.InvokeRequired)
31 m_target.BeginInvoke(new Action<IDeferred<T>,Exception>(base.SignalError), handler, error);
32 else
33 base.SignalError(handler, error);
34 }
35
28 } 36 }
29 } 37 }
30 38