using System.Windows.Forms; using System; namespace Implab.Fx { public class ControlBoundPromise : Promise { readonly Control m_target; public ControlBoundPromise(Control target) { Safe.ArgumentNotNull(target, "target"); m_target = target; } public ControlBoundPromise(Control target, IPromise parent) : base(parent) { Safe.ArgumentNotNull(target, "target"); m_target = target; } protected override void InvokeHandler(AbstractHandler handler) { if (m_target.InvokeRequired) m_target.BeginInvoke(new Action(base.InvokeHandler), handler); else base.InvokeHandler(handler); } } }