private void btn_AddRule_Click(object sender, RoutedEventArgs e) { // RuleBuilder needs to be given the id of the rule, which only the main window knows // It is equal to the current count of Rules in the rulelist RuleBuilder Builder = new RuleBuilder(RuleList.Count()); Builder.ShowDialog(); // The result is stored in the RuleList if ((bool)Builder.DialogResult == true) { try { this.RuleList.Add(Builder.CurrentRule); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btn_AddRule_MouseRightButtonUp(object sender, MouseButtonEventArgs e) { // Rightclick enables creating a rule based on the current selected existing rule if (this.lv_RuleList.SelectedIndex == -1) { // If no Rule is selected then run simple rule addition btn_AddRule_Click(sender, e); } else { int SelectedIndex = this.lv_RuleList.SelectedIndex; RuleBuilder Builder = new RuleBuilder(this.RuleList[SelectedIndex]); Builder.ShowDialog(); if ((bool)Builder.DialogResult == true) { try { this.RuleList.Add(Builder.CurrentRule); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
private void btn_ModifyRule_Click(object sender, RoutedEventArgs e) { int SelectedIndex = this.lv_RuleList.SelectedIndex; RuleBuilder Builder = new RuleBuilder(this.RuleList[SelectedIndex]); Builder.ShowDialog(); if ((bool)Builder.DialogResult == true) { RuleList[SelectedIndex] = Builder.CurrentRule; } }