public override DesultoryTaskNextFunction CanNext(object processState, object runState) { try { var compositeState = new DesultoryCompositeState() { ID = ID_True, NextFunction = DesultoryTaskNextFunction.Next, ProcessState = processState, Boolean = this.IfCondition(this, runState) }; if (DesultoryBoolean.True == compositeState.Boolean) { compositeState.NextFunction = this.TrueStatement.CanNext(processState, null); } else { if (null != this.FalseStatement) { compositeState.NextFunction = this.FalseStatement.CanNext(processState, null); } } if (compositeState.NextFunction == DesultoryTaskNextFunction.Done) { compositeState.NextFunction = DesultoryTaskNextFunction.Next; } if (null == this.NextCondition) { return(compositeState.NextFunction); } return(this.NextCondition(this, compositeState)); } catch { throw; } }
public override DesultoryTaskNextFunction CanNext(object processState, object runState) { try { int nID = (int)runState; var dti = this.Tasks.Where(t => t.ID == nID).FirstOrDefault(); var compositeState = new DesultoryCompositeState() { ID = nID, NextFunction = DesultoryTaskNextFunction.Current, ProcessState = processState }; if (null != dti) { var childResult = dti.CanNext(processState, null); if (childResult == DesultoryTaskNextFunction.Done) { lock (_syncRoot) { compositeState.NextFunction = 0 == --_remaining ? DesultoryTaskNextFunction.Next : DesultoryTaskNextFunction.Done; } } } if (null == this.NextCondition) { return(compositeState.NextFunction); } return(this.NextCondition(this, compositeState)); } catch { throw; } }