Exemplo n.º 1
0
        protected override IPromise <TR> CreatePromise <TR>(Delegate code, int insertionIndex = -1)
        {
            var result = PromiseInfo <TR> .CreateInstance(code, state : PromiseState.Unblocked, insertionIndex : insertionIndex);

            ThenUniqueID = result.UniqueID;
            return(result);
        }
Exemplo n.º 2
0
        internal static LoopPromiseInfo CreateInstance(Func <bool> delCondition, Action delBody, Action delPostBody, object target = null,
                                                       string modalUniqueId = null, PromiseState state = PromiseState.Unblocked, int insertionIndex = -1)
        {
            var instance = new LoopPromiseInfo
            {
                UniqueID  = StateManager.Current.UniqueIDGenerator.GetPromiseUniqueID(),
                Condition = PromiseInfo <bool> .CreateInstance(delCondition, target, modalUniqueId, false, PromiseState.Unblocked, insertionIndex),
                Body      = PromiseInfo.CreateInstance(delBody, target, modalUniqueId, false, PromiseState.Unblocked, insertionIndex),
                State     = PromiseState.Pinned,
                LoopState = LoopState.Condition,
                PostBody  = (delPostBody != null) ? PromiseInfo.CreateInstance(delPostBody, target, modalUniqueId, false, PromiseState.Unblocked, insertionIndex) : null
            };

            instance.NeedsSerialization = (instance.Body.NeedsSerialization || (instance.PostBody != null ? instance.PostBody.NeedsSerialization: false) || instance.Condition.NeedsSerialization);
            ViewManager.Instance.State.RegisterPromise(instance, insertionIndex);
            return(instance);
        }