Esempio n. 1
0
        // adds a rule and matching UI component based on user selection
        private void AddRuleClick(object sender, RoutedEventArgs e)
        {
            BeepRule br = BeepRule.Create((sender as MenuItem).Header.ToString(), bw.tiles);

            beepRules.Add(br);

            BeepRulesUIComponents.Add(CreateBeepRuleUserControl(br));
        }
Esempio n. 2
0
        //select different rules in UI
        private void RuleUserControlRuleSelection(object sender, EventArgs e)
        {
            BeepRuleUserControl bruc = sender as BeepRuleUserControl;

            // selected rule must be different
            if (bruc.SelectedRuleName == bruc.RuleName)
            {
                return;
            }

            beepRules.Remove(bruc.Rule);

            int index = BeepRulesUIComponents.IndexOf(bruc);

            BeepRulesUIComponents.Remove(bruc);

            BeepRule br = BeepRule.Create(bruc.SelectedRuleName, bw.tiles);

            beepRules.Add(br);

            BeepRulesUIComponents.Insert(index, CreateBeepRuleUserControl(br));
        }