public void EnableOnAllConditions(EditorID editor) { if (ConditionMode == ConditionModes.All) { return; } ApplyEvent(new EnabledOnAllConditions(editor)); }
public void RemoveTag(EditorID editor, string tag) { if (_tags.Contains(tag) == false) { return; } ApplyEvent(new TagRemoved(editor, tag)); }
public void EnableOnAnyCondition(EditorID editor) { if (ConditionMode == ConditionModes.Any) { return; } ApplyEvent(new EnabledOnAnyCondition(editor)); }
//public methods which do domainy things public void AddTag(EditorID editor, string tag) { if (_tags.Contains(tag)) { return; } ApplyEvent(new TagAdded(editor, tag)); }
public void RemoveCondition(EditorID editor, ConditionID conditionID) { if (_conditions.HasCondition(conditionID) == false) { throw new ConditionNotFoundException(conditionID); } ApplyEvent(new ConditionRemoved(editor, conditionID)); }
public void ChangeDescription(EditorID editor, string newDescription) { if (Description == newDescription) { return; } ApplyEvent(new ToggleDescriptionChanged(editor, newDescription)); }
public void Rename(EditorID editor, string newName) { if (string.IsNullOrWhiteSpace(newName)) { throw new ArgumentNullException(nameof(newName), "Toggles must have a non-whitespace name."); } if (Name == newName) { return; } ApplyEvent(new ToggleRenamed(editor, newName)); }
public ConditionID AddCondition(EditorID editor, Dictionary <string, object> conditionProperties, ConditionID parentConditionID = null) { var messages = _conditionBuilder.CanCreateFrom(conditionProperties).ToArray(); if (messages.Any()) { throw new ConditionException(messages.First()); } ValidateParentCondition(parentConditionID); var conditionID = NextConditionID(); ApplyEvent(new ConditionAdded(editor, conditionID, parentConditionID, conditionProperties)); return(conditionID); }
public static Toggle CreateNew(EditorID creator, string name, string description = "", ToggleID toggleID = null) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name), "Toggles must have a non-whitespace name."); } var toggle = new Toggle(); toggle.ApplyEvent(new ToggleCreated( creator, toggleID ?? ToggleID.CreateNew(), name.Trim(), description)); return(toggle); }
protected override object Parse(string value) => EditorID.Parse(value);
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { return(EditorID.Parse(Convert.ToString(reader.Value) ?? string.Empty)); }