Exemplo n.º 1
0
        private void RenumberRules()
        {
            int ruleNumber = 1;

            foreach (var rule in Rules)
            {
                rule.RuleNumber = ruleNumber++;
            }
            RulesTableMgr.UpdateRules(RulesetId, Rules);
        }
Exemplo n.º 2
0
        public bool ChangeRule(int ruleNumber, DeviceRule newRule)
        {
            var ruleToChange = Rules.Where((x) => x.RuleNumber == ruleNumber).FirstOrDefault();

            if (newRule != null && ruleToChange != null)
            {
                newRule.RuleNumber = ruleNumber;
                int indx = Rules.IndexOf(ruleToChange);
                Rules[indx] = newRule;
                UpdateListRulesAudioClip();
                UpdateWhichRuleAudioClip();
                return(RulesTableMgr.UpdateRules(RulesetId, Rules));
            }
            return(false);
        }