Exemplo n.º 1
0
        public static SignalFuture GetFuture(this tTask task)
        {
            var result = new SignalFuture();

            BindFuture(task, result);
            return(result);
        }
Exemplo n.º 2
0
        internal IFuture OnNextValue(object value)
        {
            OnEarlyDispose = null;

            int count;

            var seq = value as IEnumerable <T>;

            if (seq != null)
            {
                lock (_Buffer) {
                    _Buffer.AddRange(seq);
                    count = _Buffer.Count;
                }
            }
            else
            {
                T   convertedValue;
                var e = TryConvertValue(value, out convertedValue);

                if (e != null)
                {
                    Fail(e);

                    var f = new SignalFuture();
                    f.Fail(e);
                    return(f);
                }
                else
                {
                    lock (_Buffer) {
                        _Buffer.Add(convertedValue);
                        count = _Buffer.Count;
                    }
                }
            }

            if (count >= Capacity)
            {
                Resume();
                _ReadyForMoreFuture = new SignalFuture();
                return(_ReadyForMoreFuture);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        new public SignalFuture Show(IWin32Window owner = null)
        {
            var f = new SignalFuture();
            FormClosedEventHandler del = (s, e) =>
                                         f.Complete();

            f.RegisterOnComplete((_) => {
                this.FormClosed -= del;
            });
            this.FormClosed += del;

            if (owner != null)
            {
                base.Show(owner);
            }
            else
            {
                base.Show();
            }

            return(f);
        }