view Implab/Promise.cs @ 210:5dc21f6a3222 v2

Code review for RunnableComponent Added StaApartment class based on System.Windows.Forms.Application message loop
author cin
date Mon, 20 Mar 2017 17:44:18 +0300
parents 8200ab154c8a
children b1e0ffdf3451
line wrap: on
line source

using System;
using Implab.Parallels;

namespace Implab {
    public class Promise : AbstractPromise, IDeferred {
        public static readonly IPromise Success;

        static Promise() {
            Success = new SuccessPromise();
        }

        public void Resolve() {
            SetResult();
        }

        public void Reject(Exception error) {
            SetError(error);
        }

        public static IPromise FromException(Exception exception) {
            return new FailedPromise(exception);
        }
    }
}