示例#1
0
        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            bool isEntry = entryItem.FlowInput != null && entryItem.FlowInput.PropertyName == nameof(Entry);

            //bool first = true;
            //if( flow.InternalVariables.TryGetValue( this, out var value ) )
            //	first = (bool)value;

            if (isEntry || Condition)             //if( first || Condition )
            {
                //flow.InternalVariables[ this ] = false;

                //reply after LoopBody
                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(this));

                //go to LoopBody
                FlowInput next = LoopBody;
                if (next != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
                }
            }
            else
            {
                //flow.InternalVariables.Remove( this );

                //go to Exit
                FlowInput next = Exit;
                if (next != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
                }
            }
        }
示例#2
0
        //[Browsable( false )]
        //public string FlowchartNodeTitle
        //{
        //	get
        //	{
        //		//!!!!может по другому

        //		if( MemberObject != null )
        //			return MemberObject.ToString();
        //		else
        //			return null;
        //	}
        //}

        //[Browsable( false )]
        //public Component_Texture FlowchartNodeRenderTexture
        //{
        //	get { return null; }
        //}

        //[Browsable( false )]
        //public FlowchartNodeContentType FlowchartNodeContentType
        //{
        //	get
        //	{
        //		if( FlowSupport )
        //			return FlowchartNodeContentType.Flow;
        //		else
        //			return FlowchartNodeContentType.Default;
        //	}
        //}

        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            Invoke();

            FlowInput next = Exit;

            if (next != null)
            {
                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
            }
        }
示例#3
0
        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            if (valueProperty != null)
            {
                var value = valueProperty.GetValue(this, null);
                valueProperty.SetValue(this, value, null);
            }

            FlowInput next = Exit;

            if (next != null)
            {
                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
            }
        }
示例#4
0
        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            bool isEntry = entryItem.FlowInput != null && entryItem.FlowInput.PropertyName == nameof(Entry);

            IEnumerator enumerator = null;

            if (isEntry)
            {
                var collection = Collection.Value;
                if (collection != null)
                {
                    enumerator = collection.GetEnumerator();
                }
            }
            else
            {
                if (flow.InternalVariables.TryGetValue(this, out var value))
                {
                    enumerator = (IEnumerator)value;
                }
            }

            if (enumerator != null && enumerator.MoveNext())
            {
                flow.InternalVariables[this] = enumerator;

                //reply after LoopBody
                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(this));

                //go to LoopBody
                FlowInput next = LoopBody;
                if (next != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
                }
            }
            else
            {
                flow.InternalVariables.Remove(this);

                //go to Exit
                FlowInput next = Exit;
                if (next != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
                }
            }
        }
示例#5
0
        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            var variable = Variable.Value;

            if (variable != null && valueProperty != null)
            {
                var value = ReferenceUtility.GetUnreferencedValue(valueProperty.GetValue(this, null));
                flow.SetVariable(variable.GetVariableName(), value);
            }

            FlowInput next = Exit;

            if (next != null)
            {
                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
            }
        }
示例#6
0
        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            FlowInput next;

            if (Condition)
            {
                next = True;
            }
            else
            {
                next = False;
            }

            if (next != null)
            {
                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
            }
        }
示例#7
0
        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            bool isEntry = entryItem.FlowInput != null && entryItem.FlowInput.PropertyName == nameof(Entry);

            int number = -1;

            if (!isEntry)
            {
                if (flow.InternalVariables.TryGetValue(this, out var value))
                {
                    number = (int)value;
                }
            }

            number++;

            if (number < Number.Value)
            {
                flow.InternalVariables[this] = number;

                //reply after LoopBody
                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(this));

                //go to LoopBody
                FlowInput next = LoopBody;
                if (next != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
                }
            }
            else
            {
                flow.InternalVariables.Remove(this);

                //go to Exit
                FlowInput next = Exit;
                if (next != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
                }
            }
        }
示例#8
0
        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            var selection = Selection.Value;

            if (selection != null)
            {
                //!!!!always compare via strings?
                var selectionStr = selection.ToString();

                for (int nCase = 0; nCase < Cases.Count; nCase++)
                {
                    if (selectionStr == Cases[nCase])
                    {
                        var p = GetProperty(nCase);
                        if (p != null)
                        {
                            var v = (FlowInput)ReferenceUtility.GetUnreferencedValue(p.GetValue(this, null));
                            if (v != null)
                            {
                                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(v));
                                return;
                            }
                        }
                    }
                }
            }

            //Default
            {
                var p = GetProperty(-1);
                if (p != null)
                {
                    var v = (FlowInput)ReferenceUtility.GetUnreferencedValue(p.GetValue(this, null));
                    if (v != null)
                    {
                        flow.ExecutionStack.Push(new Flow.ExecutionStackItem(v));
                    }
                }
            }
        }
        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            bool isEntry = entryItem.FlowInput != null && entryItem.FlowInput.PropertyName == nameof(Entry);

            int number = -1;

            if (!isEntry)
            {
                if (flow.InternalVariables.TryGetValue(this, out var value))
                {
                    number = (int)value;
                }
            }

            number++;

            var p = GetProperty(number);

            if (p != null)
            {
                flow.InternalVariables[this] = number;

                //reply after Body
                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(this));

                //go to Body
                var v = (FlowInput)ReferenceUtility.GetUnreferencedValue(p.GetValue(this, null));
                if (v != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(v.Owner));
                    return;
                }
            }
            else
            {
                //end
                flow.InternalVariables.Remove(this);
            }
        }
示例#10
0
        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            if (Condition)
            {
                //reply after LoopBody
                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(this));

                //go to LoopBody
                FlowInput next = LoopBody;
                if (next != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
                }
            }
            else
            {
                //go to Exit
                FlowInput next = Exit;
                if (next != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
                }
            }
        }
示例#11
0
        void IFlowExecutionComponent.FlowExecution(Flow flow, Flow.ExecutionStackItem entryItem)
        {
            bool isEntry = entryItem.FlowInput != null && entryItem.FlowInput.PropertyName == nameof(Entry);

            ExecutionData executionData = null;

            if (isEntry)
            {
                var collection = Collection.Value;
                if (collection != null)
                {
                    executionData              = new ExecutionData();
                    executionData.collection   = collection;
                    executionData.currentIndex = FirstIndex;
                }
            }
            else
            {
                if (flow.InternalVariables.TryGetValue(this, out var value))
                {
                    executionData = (ExecutionData)value;
                    executionData.currentIndex++;
                }
            }

            //update Current
            if (executionData != null)
            {
                if (executionData.currentIndex >= 0 && executionData.currentIndex <= LastIndex.Value && executionData.currentIndex < executionData.collection.Count)
                {
                    executionData.current = executionData.collection[executionData.currentIndex];
                }
                else
                {
                    executionData.current = null;
                }
            }

            if (executionData != null && executionData.currentIndex >= 0 && executionData.currentIndex <= LastIndex.Value && executionData.currentIndex < executionData.collection.Count)
            {
                flow.InternalVariables[this] = executionData;

                //reply after LoopBody
                flow.ExecutionStack.Push(new Flow.ExecutionStackItem(this));

                //go to LoopBody
                FlowInput next = LoopBody;
                if (next != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
                }
            }
            else
            {
                flow.InternalVariables.Remove(this);

                //go to Exit
                FlowInput next = Exit;
                if (next != null)
                {
                    flow.ExecutionStack.Push(new Flow.ExecutionStackItem(next));
                }
            }
        }