コード例 #1
0
        public IPromise Then(PromiseAction <object> success, PromiseAction <object> failure = null)
        {
            NextDeferred = new Deferred();

            Success = new Func <object, IPromise>((parm) =>
            {
                success(parm);
                return(null);
            });
            if (failure != null)
            {
                Failure = new Func <object, IPromise>((parm) =>
                {
                    failure(parm);
                    return(null);
                });
            }

            return(NextDeferred);
        }
コード例 #2
0
ファイル: WhenAll.cs プロジェクト: emrahoner/CsQuery
        /// <summary>
        /// Chains delegates that will be executed on success or failure of a promise.
        /// </summary>
        ///
        /// <param name="success">
        /// The delegate to call upon successful resolution of the promise.
        /// </param>
        /// <param name="failure">
        /// (optional) The delegate to call upon unsuccessful resolution of the promise.
        /// </param>
        ///
        /// <returns>
        /// A new promise which will resolve when this promise has resolved.
        /// </returns>

        public IPromise Then(PromiseAction<object> success, PromiseAction<object> failure = null)
        {
            return Deferred.Then(success, failure);
        }
コード例 #3
0
ファイル: DeferredT.cs プロジェクト: jeiea/osuDownloader
        /// <summary>
        /// Bind delegates to the success or failure of a promise
        /// </summary>
        ///
        /// <param name="success">
        /// The success delegate
        /// </param>
        /// <param name="failure">
        /// (optional) the failure delegate
        /// </param>
        ///
        /// <returns>
        /// A new promise that resolves when the current promise resolves.
        /// </returns>

        public IPromise Then(PromiseAction <T> success, PromiseAction <T> failure = null)
        {
            return(base.Then(success, failure));
        }
コード例 #4
0
        /// <summary>
        /// Chains delegates that will be executed on success or failure of a promise.
        /// </summary>
        ///
        /// <param name="success">
        /// The delegate to call upon successful resolution of the promise.
        /// </param>
        /// <param name="failure">
        /// (optional) The delegate to call upon unsuccessful resolution of the promise.
        /// </param>
        ///
        /// <returns>
        /// A new promise which will resolve when this promise has resolved.
        /// </returns>

        public IPromise Then(PromiseAction <object> success, PromiseAction <object> failure = null)
        {
            return(Deferred.Then(success, failure));
        }
コード例 #5
0
ファイル: Deferred.cs プロジェクト: emrahoner/CsQuery
        /// <summary>
        /// Chains delegates that will be executed on success or failure of a promise.
        /// </summary>
        ///
        /// <param name="success">
        /// The delegate to call upon successful resolution of the promise.
        /// </param>
        /// <param name="failure">
        /// (optional) The delegate to call upon unsuccessful resolution of the promise.
        /// </param>
        ///
        /// <returns>
        /// A new promise which will resolve when this promise has resolved.
        /// </returns>

        public IPromise Then(PromiseAction<object> success, PromiseAction<object> failure = null)
        {
            lock (Locker)
            {
                var deferred = GetNextDeferred();
                Success = new Func<object, IPromise>((parm) =>
                {
                    success(parm);
                    return null;
                });
                if (failure != null)
                {
                    Failure = new Func<object, IPromise>((parm) =>
                    {
                        failure(parm);
                        return null;
                    });

                }

                return deferred;
            }
        }
コード例 #6
0
ファイル: TimeoutT.cs プロジェクト: jeiea/osuDownloader
        /// <summary>
        /// Chains delegates that will be executed on success or failure of a promise.
        /// </summary>
        ///
        /// <param name="success">
        /// The delegate to call upon successful resolution of the promise.
        /// </param>
        /// <param name="failure">
        /// (optional) The delegate to call upon unsuccessful resolution of the promise.
        /// </param>
        ///
        /// <returns>
        /// A new promise which will resolve when this promise has resolved.
        /// </returns>

        IPromise IPromise.Then(PromiseAction <object> success, PromiseAction <object> failure)
        {
            return(deferred.Then(success, failure));
        }