public override ActivityResult Execute(IEvent e) { try { if (e.GetEventData() != null) { object data = Condition.Selector != null?e.GetEventData(Condition.Selector) : e.GetEventData(); switch (Condition.Operator) { case ConditionOperator.EQ: if (data.Equals(Condition.ExpectedValue)) { ExecuteDoNodes(e); } else { ExecuteElseNodes(e); } break; case ConditionOperator.NE: if (!data.Equals(Condition.ExpectedValue)) { ExecuteDoNodes(e); } else { ExecuteElseNodes(e); } break; default: break; } } else { throw new Exception("Expected condition in ConditionEvent."); } } catch (Exception ex) { return(ActivityResult.Failure(ex)); } return(ActivityResult.Success()); }
public override ActivityResult Execute(IEvent e) { try { foreach (var item in Items) { foreach (var hook in this._hooks) { hook.OnEach(item, ItemType); } } } catch (Exception ex) { return(ActivityResult.Failure(ex)); } return(ActivityResult.Success()); }