예제 #1
0
        public void EnableOnAllConditions(EditorID editor)
        {
            if (ConditionMode == ConditionModes.All)
            {
                return;
            }

            ApplyEvent(new EnabledOnAllConditions(editor));
        }
예제 #2
0
        public void RemoveTag(EditorID editor, string tag)
        {
            if (_tags.Contains(tag) == false)
            {
                return;
            }

            ApplyEvent(new TagRemoved(editor, tag));
        }
예제 #3
0
        public void EnableOnAnyCondition(EditorID editor)
        {
            if (ConditionMode == ConditionModes.Any)
            {
                return;
            }

            ApplyEvent(new EnabledOnAnyCondition(editor));
        }
예제 #4
0
        //public methods which do domainy things
        public void AddTag(EditorID editor, string tag)
        {
            if (_tags.Contains(tag))
            {
                return;
            }

            ApplyEvent(new TagAdded(editor, tag));
        }
예제 #5
0
        public void RemoveCondition(EditorID editor, ConditionID conditionID)
        {
            if (_conditions.HasCondition(conditionID) == false)
            {
                throw new ConditionNotFoundException(conditionID);
            }

            ApplyEvent(new ConditionRemoved(editor, conditionID));
        }
예제 #6
0
파일: Toggle.cs 프로젝트: Pondidum/Crispin
        public void ChangeDescription(EditorID editor, string newDescription)
        {
            if (Description == newDescription)
            {
                return;
            }

            ApplyEvent(new ToggleDescriptionChanged(editor, newDescription));
        }
예제 #7
0
파일: Toggle.cs 프로젝트: Pondidum/Crispin
        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));
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
 protected override object Parse(string value) => EditorID.Parse(value);
예제 #11
0
 public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 {
     return(EditorID.Parse(Convert.ToString(reader.Value) ?? string.Empty));
 }