view Implab.Fx/ControlBoundPromise.cs @ 104:5f10d54b45df v2

renamed Promise.Last -> Promise.On Promise.On doesn't changes Promise.IsExclusive property
author cin
date Sun, 09 Nov 2014 23:03:45 +0300
parents b4c4d65b7def
children d4e38929ce36
line wrap: on
line source

using System.Windows.Forms;
using System;


namespace Implab.Fx {
    public class ControlBoundPromise<T> : Promise<T> {
        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(HandlerDescriptor handler) {
            if (m_target.InvokeRequired)
                m_target.BeginInvoke(new Action<HandlerDescriptor>(base.InvokeHandler), handler);
            else
                base.InvokeHandler(handler);
        }
    }
}