protected override IPromise <TR> CreatePromise <TR>(Delegate code, int insertionIndex = -1)
        {
            var promise = PromiseInfo <TR> .CreateInstance(code, insertionIndex : insertionIndex);

            ThenUniqueID = promise.UniqueID;
            return(promise);
        }
示例#2
0
        protected override IPromise <TR> CreatePromise <TR>(Delegate code, int insertionIndex = -1)
        {
            var result = PromiseInfo <TR> .CreateInstance(code, modalUniqueId : _modalUniqueIdForRelatedPromise, state : State, insertionIndex : insertionIndex);

            ThenUniqueID = result.UniqueID;
            return(result);
        }
示例#3
0
        public static PromiseInfo CreateInstance(Delegate code, object target = null, string modalUniqueId = null, bool registerPromise = true, PromiseState state = PromiseState.Unblocked, int insertionIndex = -1)
        {
            var instance = new PromiseInfo
            {
#if DEBUG
                UserCodeInfo = DebugUtils.GetUserCodeInfo(new StackTrace(true)),
#endif
                State = state,
                // We will use the ParentId to identify promises belongs from a exploited promise, and know they are relative between them.
                ParentId = (ViewManager.Instance.State.InPromiseExecution && ViewManager.Instance.State.ExecutingPromiseInfo != null) ? ViewManager.Instance.State.ExecutingPromiseInfo.UniqueID : String.Empty
            };

            BuildContinuationInfo(StateManager.Current, instance, code, modalUniqueId, target);
            if (registerPromise)
            {
                ViewManager.Instance.State.RegisterPromise(instance, insertionIndex);
            }

            return(instance);
        }
示例#4
0
        public static PromiseInfo <T> CreateInstance(Delegate code, Object target = null, string modalUniqueId = null,
                                                     bool registerPromise         = true, PromiseState state   = PromiseState.Unblocked, int insertionIndex = -1)
        {
            var instance = new PromiseInfo <T>
            {
#if DEBUG
                UserCodeInfo = DebugUtils.GetUserCodeInfo(new StackTrace(true)),
#endif
                State    = state,
                ParentId = (ViewManager.Instance.State.InPromiseExecution && ViewManager.Instance.State.ExecutingPromiseInfo != null) ? ViewManager.Instance.State.ExecutingPromiseInfo.UniqueID : String.Empty
            };

            BuildContinuationInfo(StateManager.Current, instance, code, modalUniqueId, target);
            if (registerPromise)
            {
                ViewManager.Instance.State.RegisterPromise(instance, insertionIndex);
            }

            return(instance);
        }