comparison Implab.Fx/ControlBoundPromise.cs @ 72:d67b95eddaf4 v2

promises refactoring
author cin
date Thu, 04 Sep 2014 18:47:12 +0400
parents
children b4c4d65b7def
comparison
equal deleted inserted replaced
71:1714fd8678ef 72:d67b95eddaf4
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
15 public ControlBoundPromise(Control target, IPromise parent, bool cancellable)
16 : base(parent, cancellable) {
17 Safe.ArgumentNotNull(target, "target");
18
19 m_target = target;
20 }
21
22 protected override void InvokeHandler(HandlerDescriptor handler) {
23 if (m_target.InvokeRequired)
24 m_target.BeginInvoke(new Action<HandlerDescriptor>(base.InvokeHandler), handler);
25 else
26 base.InvokeHandler(handler);
27 }
28 }
29 }
30