public void MatchSensor(string Sensor) { foreach (var Cond in Conditions) { if (Cond.MatchSensor(Sensor)) { StateConditionTriggered?.Invoke(this, new ScriptStateEventArgs(Cond, Cond.NextState, false)); if (Cond.NextState.Trim() != "") { Deactivate(); StateCompleted?.Invoke(this, new ScriptStateEventArgs(Cond, Cond.NextState, false)); } } } }