示例#1
0
        private void AddNewActionElement([NotNull] XElement actionsElement, [NotNull] RuleEditor.ActionItem actionItem)
        {
            Debug.ArgumentNotNull(actionsElement, nameof(actionsElement));
            Debug.ArgumentNotNull(actionItem, nameof(actionItem));

            var actionElement = new XElement(@"action");

            actionElement.Add(new XAttribute(@"id", actionItem.Id));
            actionElement.Add(new XAttribute(@"uid", Guid.NewGuid().ToString(@"B").ToUpperInvariant()));

            actionsElement.Add(actionElement);
        }
        public void AddAction([NotNull] RuleEditor.ActionItem actionItem)
        {
            Assert.ArgumentNotNull(actionItem, nameof(actionItem));

            if (RuleModel.CurrentRule == null && RuleModel.Rules.Elements().Count() == 1)
            {
                RuleModel.CurrentRule = RuleModel.Rules.Elements().FirstOrDefault();
            }

            RuleModel.AddAction(actionItem);

            Render();
            RaiseModified();
        }
示例#3
0
        public void AddAction([NotNull] RuleEditor.ActionItem actionItem)
        {
            Assert.ArgumentNotNull(actionItem, nameof(actionItem));

            if (CurrentRule == null)
            {
                return;
            }

            var actionsElement = CurrentRule.Element(@"actions");

            if (actionsElement == null)
            {
                actionsElement = new XElement(@"actions");
                CurrentRule.Add(actionsElement);
            }

            AddNewActionElement(actionsElement, actionItem);
        }