public void Setup()
 {
     _existingBlock = new Block
     {
         Name      = "old",
         StartDate = DateTime.MaxValue,
         EndDate   = DateTime.MaxValue,
         Teachers  = new List <Teacher> {
             new Teacher {
                 Id = 1
             }
         },
         Classes = new Collection <Class>()
     };
     _action = new UpdateBlock(new Block
     {
         Name      = "new",
         StartDate = DateTime.MinValue.AddYears(1).Date,
         EndDate   = DateTime.MinValue.AddYears(1).Date,
         Teachers  = new List <Teacher> {
             new Teacher {
                 Id = 1
             }
         }
     });
     _repositoryBuilder = new MockRepositoryBuilder <Block>()
                          .WithGet(_existingBlock)
                          .WithUpdate();
     _teacherRepositoryBuilder = new MockRepositoryBuilder <Teacher>()
                                 .WithSuccessfulGet();
 }
Example #2
0
        public UpdateBlock <MessageType> CreateUpdateBlock <MessageType>(string dbName, string name, UpdatePolicy policy)
        {
            var block = new UpdateBlock <MessageType>(EventProcessor, EventProcessor.GetRamDb(dbName), policy);

            SetDebugName(block, name);
            return(block);
        }
        void OnUpdate(float elapsed)
        {
            if (enabledX)
            {
                float duration = durationX;
                if (elapsed > duration)
                {
                    elapsed = duration;
                }

                PhaseX = _easingX == null ? elapsed / duration : _easingX.Invoke(elapsed / duration);
            }
            if (enabledY)
            {
                float duration = durationY;
                if (elapsed > duration)
                {
                    elapsed = duration;
                }
                PhaseY = _easingY == null ? elapsed / duration : _easingY.Invoke(elapsed / duration);
            }

            Delegate.AnimatorUpdated(this);
            UpdateBlock?.Invoke();
        }
        /// <summary>
        /// Removes a update block.
        /// </summary>
        /// <param name="block"></param>
        public void Remove(UpdateBlock <Player.Player> block)
        {
            var current = blocks[block.GetOrdinal()] as UpdateBlock <Player.Player>;

            if (current != block)
            {
                return;
            }
            blocks[block.GetOrdinal()] = null;
        }
Example #5
0
        public static string UpdateBuildingBlock(string jsons)//更新板块信息
        {
            UpdateBlock block  = JsonConvert.DeserializeObject <UpdateBlock>(jsons);
            string      result = "";

            for (int i = 0; i < block.blocks.Count(); i++)
            {
                result = HTTPService.UpdateWallBlock(block.blocks[i], block.blockvalue[i]);
            }
            return(result);
        }
Example #6
0
        public async void PostBlockNameSuccess(string resultBlock)
        {
            BlockModel  = new BlockModel();
            updateBlock = new UpdateBlock();
            BlockName   = string.Empty;
            await App.Current.MainPage.DisplayAlert("HMS", resultBlock, "OK");

            OnPropertyChanged("BlockName");
            OnPropertyChanged("BlockModel");
            //await App.Current.MainPage.Navigation.PopModalAsync(true);
            //MessagingCenter.Send<EditBlock>((EditBlock)this, "click_profile_tab");
        }
Example #7
0
        private void AnimationLoop()
        {
            var currentTime = System.Diagnostics.Stopwatch.GetTimestamp();

            UpdateAnimationPhases(currentTime);

            Delegate.AnimatorUpdated(this);
            UpdateBlock?.Invoke();


            if (currentTime >= endTime)
            {
                Stop();
            }
        }
        void OnStop()
        {
            enabledX = false;
            enabledY = false;

            // If we stopped an animation in the middle, we do not want to leave it like this
            if (PhaseX != 1.0f || PhaseY != 1.0f)
            {
                PhaseX = 1.0f;
                PhaseX = 1.0f;

                Delegate.AnimatorUpdated(this);
                UpdateBlock?.Invoke();
            }

            Delegate.AnimatorStopped(this);
            StopBlock?.Invoke();
        }
Example #9
0
        private async Task executePage(EventPage page, CancellationToken cancellation)
        {
            using (var session = _store.OpenSession())
            {
                await _projection.ApplyAsync(session, page.Streams, cancellation).ConfigureAwait(false);

                session.QueueOperation(new EventProgressWrite(_events, _projection.Produces.FullName, page.To));

                await session.SaveChangesAsync(cancellation).ConfigureAwait(false);

                _logger.PageExecuted(page, this);

                LastEncountered = page.To;

                evaluateWaiters();

                UpdateBlock?.Post(new StoreProgress(_projection.Produces, page));
            }
        }
Example #10
0
        private async Task executePage(EventPage page, CancellationToken cancellation)
        {
            // TODO -- have to pass in the tenant here
            using (var session = _store.OpenSession())
            {
                await _projection.ApplyAsync(session, page, cancellation).ConfigureAwait(false);

                session.QueueOperation(new EventProgressWrite(_events, _projection.ProjectedType().FullName, page.To));

                await session.SaveChangesAsync(cancellation).ConfigureAwait(false);

                _logger.PageExecuted(page, this);

                // This is a change to accomodate the big gap problem
                LastEncountered = page.LastEncountered();

                evaluateWaiters();

                UpdateBlock?.Post(new StoreProgress(_projection.ProjectedType(), page));
            }
        }
        /// <summary>
        /// 解释 UPDATE 命令。
        /// </summary>
        /// <param name="DbParameters">用于缓存在解释过程中可能会产生的参数。</param>
        /// <returns></returns>
        public override string Parsing(ref List <IDbDataParameter> DbParameters)
        {
            UpdateBlock   ub      = (UpdateBlock)this.Description;
            StringBuilder cBuffer = new StringBuilder("UPDATE");
            string        item_buf;

            foreach (IDescription d in ub.Blocks)
            {
                d.DescriptionParserAdapter = ub.DescriptionParserAdapter;
                item_buf = d.GetParser().Parsing(ref DbParameters);
                if (item_buf[0] == (char)0x20)
                {
                    cBuffer.Append(item_buf);
                }
                else
                {
                    cBuffer.AppendFormat(" {0}", item_buf);
                }
            }
            return(cBuffer.ToString());
        }
Example #12
0
        public void Stop()
        {
            if (displayLink != null)
            {
                displayLink.RemoveFromRunLoop(Foundation.NSRunLoop.Main, Foundation.NSRunLoopMode.Common);
                displayLink = null;

                enabledX = false;
                enabledY = false;

                // If we stopped an animation in the middle, we do not want to leave it like this
                if (PhaseX != 1.0 || PhaseY != 1.0)
                {
                    PhaseX = 1.0f;
                    PhaseX = 1.0f;

                    Delegate.AnimatorUpdated(this);
                    UpdateBlock?.Invoke();
                }

                Delegate.AnimatorStopped(this);
                StopBlock?.Invoke();
            }
        }
Example #13
0
 private void stopConsumers()
 {
     UpdateBlock?.Complete();
     _executionTrack?.Complete();
 }
Example #14
0
 public void QueuePage(EventPage page)
 {
     UpdateBlock.Post(new CachePageUpdate(page));
 }
Example #15
0
        public GraphNode()
        {
            UID = ProtoCore.DSASM.Constants.kInvalidIndex;
            dependencyGraphListID = ProtoCore.DSASM.Constants.kInvalidIndex;
            dimensionNodeList = new List<UpdateNode>();
            updateNodeRefList = new List<ProtoCore.AssociativeGraph.UpdateNodeRef>();
            isDirty = true;
            isParent = false;
            isReturn = false;
            procIndex = ProtoCore.DSASM.Constants.kGlobalScope;
            classIndex = ProtoCore.DSASM.Constants.kInvalidIndex;
            updateBlock = new UpdateBlock();
            dependentList = new List<GraphNode>();
            allowDependents = true;
            isIndexingLHS = false;
            isLHSNode = false;
            firstProc = null;
            firstProcRefIndex = ProtoCore.DSASM.Constants.kInvalidIndex;
            isVisited = false;
            isCyclic = false;
            isInlineConditional = false;
            counter = 0;
            updatedArguments = new List<UpdateNodeRef>();
            dependencyTestRecursiveDepth = 0;
            isAutoGenerated = false;
            isLanguageBlock = false;
            languageBlockId = ProtoCore.DSASM.Constants.kInvalidIndex;
            updateDimensions = new List<StackValue>();
            propertyChanged = false;
            forPropertyChanged = false;

            #if __PROTOTYPE_ARRAYUPDATE_FUNCTIONCALL
            ArrayPointer = ProtoCore.DSASM.StackUtils.BuildNull();
            #endif
        }
Example #16
0
        public GraphNode()
        {
            UID = ProtoCore.DSASM.Constants.kInvalidIndex;
            AstID = ProtoCore.DSASM.Constants.kInvalidIndex;
            dependencyGraphListID = ProtoCore.DSASM.Constants.kInvalidIndex;
            dimensionNodeList = new List<UpdateNode>();
            updateNodeRefList = new List<ProtoCore.AssociativeGraph.UpdateNodeRef>();
            isDirty = true;
            isReturn = false;
            procIndex = ProtoCore.DSASM.Constants.kGlobalScope;
            classIndex = ProtoCore.DSASM.Constants.kInvalidIndex;
            updateBlock = new UpdateBlock();
            dependentList = new List<GraphNode>();
            allowDependents = true;
            isIndexingLHS = false;
            isLHSNode = false;
            firstProc = null;
            firstProcRefIndex = ProtoCore.DSASM.Constants.kInvalidIndex;
            isCyclic = false;
            isInlineConditional = false;
            counter = 0;
            updatedArguments = new List<UpdateNodeRef>();
            isAutoGenerated = false;
            languageBlockId = ProtoCore.DSASM.Constants.kInvalidIndex;
            updateDimensions = new List<StackValue>();
            propertyChanged = false;
            forPropertyChanged = false;
            lastGraphNode = null;
            isActive = true;

            #if __PROTOTYPE_ARRAYUPDATE_FUNCTIONCALL
            ArrayPointer = ProtoCore.DSASM.StackValue.Null;
            #endif
            symbolListWithinExpression = new List<SymbolNode>();
            reExecuteExpression = false;
            SSASubscript = ProtoCore.DSASM.Constants.kInvalidIndex;
            IsLastNodeInSSA = false;
        }
Example #17
0
            private void OnParseRequest(string rawValue, ref ControllerCollection childrenContainer, Global.ArgumentInfoCollection contentArguments)
            {
                MatchCollection mainPatternMatches = RegularExpression.Current.MainCapturePattern.Matches(rawValue);

                if (mainPatternMatches.Count == 0)
                {
                    childrenContainer.Add(new Renderless(0, rawValue, contentArguments));
                }
                else
                {
                    int lastIndex = 0;

                    Match mainSearchMatch;
                    // For Opening Brackets
                    Match  bracketOpenExamMatch;
                    string directiveType, directiveID;
                    // For Separator Brackets
                    Match bracketSeparatorExamMatch;
                    // For Closing Brackets
                    Match bracketCloseExamMatch;

                    IEnumerator remEnum = mainPatternMatches.GetEnumerator();

                    while (remEnum.MoveNext())
                    {
                        mainSearchMatch = (Match)remEnum.Current;

                        // Check till this match any renderless content exists
                        if (mainSearchMatch.Index > lastIndex)
                        {
                            childrenContainer.Add(
                                new Renderless(
                                    lastIndex,
                                    rawValue.Substring(lastIndex, mainSearchMatch.Index - lastIndex),
                                    contentArguments
                                    )
                                );
                            lastIndex = mainSearchMatch.Index;
                        }

                        // Exam For Bracketed Regex Result
                        bracketOpenExamMatch = RegularExpression.Current.BracketedControllerOpenPattern.Match(mainSearchMatch.Value);

                        if (bracketOpenExamMatch.Success)
                        {
                            directiveType = bracketOpenExamMatch.Result("${DirectiveType}");
                            directiveID   = bracketOpenExamMatch.Result("${ItemID}");

                            if (directiveID != null)
                            {
                                int        innerMatch       = 0;
                                List <int> separatorIndexes = new List <int>();

                                while (remEnum.MoveNext())
                                {
                                    Match mainSearchMatchExam = (Match)remEnum.Current;

                                    // Exam For Opening Bracketed Regex Result
                                    bracketOpenExamMatch =
                                        RegularExpression.Current.BracketedControllerOpenPattern.Match(mainSearchMatchExam.Value);
                                    // Check is Another Same Named Control Internally Opened Bracket
                                    if (bracketOpenExamMatch.Success &&
                                        string.Compare(directiveID, bracketOpenExamMatch.Result("${ItemID}")) == 0)
                                    {
                                        innerMatch += 1;

                                        continue;
                                    }

                                    // Exam For Separator Bracketed Regex Result
                                    bracketSeparatorExamMatch =
                                        RegularExpression.Current.BracketedControllerSeparatorPattern.Match(mainSearchMatchExam.Value);
                                    // Check is Same Named Highlevel Control Separator Bracket
                                    if (bracketSeparatorExamMatch.Success &&
                                        string.Compare(directiveID, bracketSeparatorExamMatch.Result("${ItemID}")) == 0 &&
                                        innerMatch == 0)
                                    {
                                        // Point the location of Separator Bracket index
                                        separatorIndexes.Add(mainSearchMatchExam.Index - mainSearchMatch.Index);

                                        continue;
                                    }

                                    // Exam For Closing Bracketed Regex Result
                                    bracketCloseExamMatch =
                                        RegularExpression.Current.BracketedControllerClosePattern.Match(mainSearchMatchExam.Value);
                                    // Check is Same Named Control Internally Closed Bracket
                                    if (bracketCloseExamMatch.Success &&
                                        string.Compare(directiveID, bracketCloseExamMatch.Result("${ItemID}")) == 0)
                                    {
                                        if (innerMatch > 0)
                                        {
                                            innerMatch -= 1;

                                            continue;
                                        }

                                        string modifierText         = string.Format("~{0}", mainSearchMatch.Index);
                                        string pointedOriginalValue =
                                            rawValue.Substring(mainSearchMatch.Index, (mainSearchMatchExam.Index + mainSearchMatchExam.Length) - mainSearchMatch.Index);

                                        pointedOriginalValue = pointedOriginalValue.Insert(pointedOriginalValue.Length - 1, modifierText);
                                        for (int idxID = separatorIndexes.Count - 1; idxID >= 0; idxID += -1)
                                        {
                                            pointedOriginalValue = pointedOriginalValue.Insert((separatorIndexes[idxID] + string.Format("}}:{0}", directiveID).Length), modifierText);
                                        }
                                        pointedOriginalValue = pointedOriginalValue.Insert(mainSearchMatch.Length - 2, modifierText);

                                        IController workingDirective = null;

                                        string directiveRawValue = string.Format("${0}:", (string.IsNullOrEmpty(directiveType) ? directiveID : directiveType));
                                        switch (DirectiveHelper.CaptureDirectiveType(directiveRawValue))
                                        {
                                        case DirectiveTypes.Control:
                                            workingDirective = ControlHelper.MakeControl(mainSearchMatch.Index, pointedOriginalValue, null, this.OnControlResolveRequest);

                                            break;

                                        case DirectiveTypes.InLineStatement:
                                            workingDirective = new InLineStatement(mainSearchMatch.Index, pointedOriginalValue, null);

                                            break;

                                        case DirectiveTypes.UpdateBlock:
                                            workingDirective = new UpdateBlock(mainSearchMatch.Index, pointedOriginalValue, null);

                                            break;

                                        case DirectiveTypes.EncodedExecution:
                                            workingDirective = new EncodedExecution(mainSearchMatch.Index, pointedOriginalValue, null);

                                            break;

                                        case DirectiveTypes.MessageBlock:
                                            workingDirective = new MessageBlock(mainSearchMatch.Index, pointedOriginalValue, null);

                                            break;

                                        case DirectiveTypes.PartialCache:
                                            workingDirective = new PartialCache(mainSearchMatch.Index, pointedOriginalValue, null);

                                            break;
                                        }

                                        if (workingDirective != null)
                                        {
                                            if (workingDirective is IDeploymentAccessRequires)
                                            {
                                                ((IDeploymentAccessRequires)workingDirective).DeploymentAccessRequested += this.OnDeploymentAccessRequest;
                                            }

                                            if (workingDirective is IInstanceRequires)
                                            {
                                                ((IInstanceRequires)workingDirective).InstanceRequested += this.OnInstanceRequest;
                                            }

                                            childrenContainer.Add(workingDirective);
                                        }

                                        lastIndex = (mainSearchMatchExam.Index + mainSearchMatchExam.Length);

                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            switch (ControllerHelper.CaptureControllerType(mainSearchMatch.Value))
                            {
                            case ControllerTypes.Property:
                                Property propertyDirective =
                                    new Property(mainSearchMatch.Index, mainSearchMatch.Value, contentArguments);
                                propertyDirective.InstanceRequested += this.OnInstanceRequest;

                                childrenContainer.Add(propertyDirective);

                                break;

                            case ControllerTypes.Directive:
                                IController workingDirective = null;

                                switch (DirectiveHelper.CaptureDirectiveType(mainSearchMatch.Value))
                                {
                                case DirectiveTypes.Control:
                                    workingDirective = ControlHelper.MakeControl(mainSearchMatch.Index, mainSearchMatch.Value, null, this.OnControlResolveRequest);

                                    break;

                                case DirectiveTypes.Template:
                                    workingDirective = new Template(mainSearchMatch.Index, mainSearchMatch.Value, null);

                                    break;

                                case DirectiveTypes.Translation:
                                    workingDirective = new Translation(mainSearchMatch.Index, mainSearchMatch.Value, null);

                                    break;

                                case DirectiveTypes.HashCodePointedTemplate:
                                    workingDirective = new HashCodePointedTemplate(mainSearchMatch.Index, mainSearchMatch.Value, null);

                                    break;

                                case DirectiveTypes.Execution:
                                    workingDirective = new Execution(mainSearchMatch.Index, mainSearchMatch.Value, null);

                                    break;

                                case DirectiveTypes.InLineStatement:
                                    workingDirective = new InLineStatement(mainSearchMatch.Index, mainSearchMatch.Value, null);

                                    break;

                                case DirectiveTypes.UpdateBlock:
                                    workingDirective = new UpdateBlock(mainSearchMatch.Index, mainSearchMatch.Value, null);

                                    break;

                                case DirectiveTypes.EncodedExecution:
                                    workingDirective = new EncodedExecution(mainSearchMatch.Index, mainSearchMatch.Value, null);

                                    break;

                                case DirectiveTypes.PartialCache:
                                    workingDirective = new PartialCache(mainSearchMatch.Index, mainSearchMatch.Value, null);

                                    break;
                                }

                                if (workingDirective != null)
                                {
                                    if (workingDirective is IDeploymentAccessRequires)
                                    {
                                        ((IDeploymentAccessRequires)workingDirective).DeploymentAccessRequested += this.OnDeploymentAccessRequest;
                                    }

                                    if (workingDirective is IInstanceRequires)
                                    {
                                        ((IInstanceRequires)workingDirective).InstanceRequested += this.OnInstanceRequest;
                                    }

                                    childrenContainer.Add(workingDirective);
                                }

                                break;
                            }

                            lastIndex = (mainSearchMatch.Index + mainSearchMatch.Value.Length);
                        }
                    }

                    if (rawValue.Length - lastIndex > 1)
                    {
                        childrenContainer.Add(
                            new Renderless(lastIndex, rawValue.Substring(lastIndex), contentArguments));
                    }
                }
            }
 /// <summary>
 /// Flags an update block to be used.
 /// </summary>
 /// <param name="block"></param>
 public void Flag(UpdateBlock <Player.Player> block)
 {
     blocks[block.GetOrdinal()] = block;
 }