internal ActionHandlerResult TryHandleStopped() { ActionHandlerResult ret = new ActionHandlerResult(this); ActionUnit ou = ActionUnitStop; if (ou != null) { ret = Handle(ou); } return(ret); }
internal ActionHandlerResult TryHandle(IActionCase actionCase) { ActionHandlerResult ret = null; if (Token.IsStateActive) { if (ActionUnits.Count > 0) { ActionUnit ou = ActionUnits.FirstOrDefault(x => x.TryHandle(actionCase)); ret = Handle(ou); if (ou != null && ou.TimeoutMs > 0) { Token.Reset(ou.TimeoutMs); } } } return(ret); }
internal ActionHandlerResult Start() { ActionHandlerResult ret = null; Token.Name = Name; CreateInstance(); CreateWorkflow(); Token.SetRunning(); if (ActionUnits.Count > 0) { ActionUnit ou = ActionUnits.FirstOrDefault(x => x is StartActionUnit); ret = Handle(ou); if (ou != null) { Token.Reset(ou.TimeoutMs); } } return(ret); }
private ActionHandlerResult Handle(ActionUnit actionUnit) { ActionHandlerResult ret = null; if (actionUnit != null) { ret = new ActionHandlerResult(this); { ActionUnit ou = actionUnit; if (actionUnit is DataReceivedUnit) { DataReceivedUnit dou = (DataReceivedUnit)actionUnit; if (dou.DataFrame != null && dou.DataFrame.Data != null) { AddTraceLogItem(DateTime.Now, dou.DataFrame.Data, false); } } if (ou.Func != null) { ou.Func(ou); } if (Token.IsStateActive) { if (ou.ActionItems != null && ou.ActionItems.Count > 0) { foreach (var item in ou.ActionItems) { item.ParentAction = this; ret.NextActions.Add(item); } } else { FixStates(); } } } } return(ret); }