コード例 #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));
 }