Esempio n. 1
0
        public override void Remove(RuleViewModelBase rule, bool showOnSnackbar = true)
        {
            var index = _rules.IndexOf(rule);

            if (index == -1)
            {
                return;
            }

            _model.Rules.Remove(rule.Rule);
            _rules.Remove(rule);

            if (!showOnSnackbar)
            {
                return;
            }

            _eventAggregator.PublishOnCurrentThread(new SnackbarMessage()
            {
                Action = smq => smq.Enqueue($"Rule \"{rule.Name}\" removed", "UNDO",
                                            () =>
                {
                    _rules.Insert(index, rule);
                    _model.Rules.Add(rule.Rule);
                }, true)
            });
        }
Esempio n. 2
0
 public static bool IsParentOf(this RuleParentViewModelBase ruleParent, RuleViewModelBase rule)
 {
     return(ruleParent.TraverseRulesTree()
            .Any(r => r == rule));
 }
 public abstract void Add(RuleViewModelBase ruleViewModel);
 public virtual void Save(RuleViewModelBase rule)
 {
     _eventAggregator.PublishOnCurrentThread(new SaveRuleMessage(rule.Rule));
 }
 public abstract void Remove(RuleViewModelBase rule, bool showOnSnackbar = true);
Esempio n. 6
0
 public override void Add(RuleViewModelBase ruleViewModel)
 {
     _rules.Add(ruleViewModel);
     _model.Rules.Add(ruleViewModel.Rule);
 }