示例#1
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns>true if there is at least one node to be activated else returns false</returns>
        public bool DoOneStep()
        {
            if (GetNumberOfActiveProcess() > 0)
            {
                if (State == SequenceState.Pause)
                {
                    if (m_LastExecution != null)
                    {
                        m_LastExecution.Slot.Node.IsProcessing = false;
                    }
                }

                ProcessingContext context = m_CallStacks[m_CurrentCallStackIndex];
                ProcessingContextStep contextStep = context.PopStep();

                if (contextStep == null)
                {
                    m_CallStacks.Remove(context);
                    context.SequenceBase.ResetNodes();
                }
                else
                {
                    ActionNode node = contextStep.Slot.Node as ActionNode;
                    m_LastExecution = contextStep;

                    ActionNode.ProcessingInfo info = node.Activate(context, contextStep.Slot);
                    node.ErrorMessage = info.ErrorMessage;

                    if (info.State == ActionNode.LogicState.Error)
                    {
                        context.IsOnError = true;
                    }

                    if (State == SequenceState.Pause)
                    {
                        m_LastExecution.Slot.Node.IsProcessing = true;
                    }
                }
            }

            return SetNextProcess();
        }
示例#2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="context_"></param>
 /// <param name="step_"></param>
 public void RemoveExecution(ProcessingContext context_, ProcessingContextStep step_)
 {
     context_.m_NextExecutions.Remove(step_);
 }
示例#3
0
        /// <summary>
        /// 
        /// </summary>
        private void ProcessLoop(bool sleep_ = true)
        {
            bool processing = true;

            while (processing == true
                && m_MustStop == false)
            {
                if (m_IsOnPause == false)
                {
                    processing = DoOneStep();

                    if (processing == true)
                    {
                        State = SequenceState.Running;
                    }
                }
                else if (m_UpdateOnlyOneStep == true)
                {
                    m_UpdateOnlyOneStep = false;
                    processing = DoOneStep();

                    if (processing == true)
                    {
                        State = SequenceState.Pause;
                    }
                }

                if (sleep_ == true)
                {
                    // Do sleep else all WPF bindings will block the UI thread
                    // 5ms else the UI is not enough responsive
                    System.Threading.Thread.Sleep(5);
                }
            };

            State = SequenceState.Stop;
            m_LastExecution = null;

            foreach (ProcessingContext c in m_CallStacks)
            {
                c.SequenceBase.ResetNodes();
            }
        }
示例#4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node_"></param>
        public ProcessingContextStep RegisterNextExecution(NodeSlot slot_)
        {
            if (slot_.Node is ActionNode == false)
            {
                throw new InvalidOperationException("ProcessingContext.RegisterNextExecution() : the node is not an ActionNode");
            }

            ProcessingContextStep step = new ProcessingContextStep(SequenceBase, CurrentFrame, slot_);
            CurrentProcessingContext.m_NextExecutions.Add(step);
            return step;
        }