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)); } } }
public static void Execute(FlowInput entry, IEnumerable <Tuple <string, object> > initVariables = null) { var flow = ExecuteWithoutRemoveFromStack(entry, initVariables); RemoveFromStack(flow); //return flow; }
bool EqualsImpl(FlowInput a) { if (ReferenceEquals(this, a)) { return(true); } return(owner == a.owner); }
//[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)); } }
void Process(FlowInput entry) { if (entry != null) { ExecutionStack.Push(new ExecutionStackItem(entry)); } while (ExecutionStack.Count != 0) { var item = ExecutionStack.Pop(); item.Component.FlowExecution(this, item); } }
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)); } }
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)); } } }
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)); } }
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)); } } }
public static Flow ExecuteWithoutRemoveFromStack(FlowInput entry, IEnumerable <Tuple <string, object> > initVariables = null) { InitFlowStack(); var flow = new Flow(); //flow.initParameter = initParameter; flowStack.Add(flow); if (initVariables != null) { foreach (var t in initVariables) { flow.SetVariable(t.Item1, t.Item2); } } //if( initParameter != null ) // flow.SetVariable( "InitParameter", initParameter ); flow.Process(entry); return(flow); }
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)); } } }
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)); } } }
public bool Equals(FlowInput input) { return(this == input); }
public ExecutionStackItem(FlowInput flowInput) { this.flowInput = flowInput; this.component = flowInput.Owner; }