/// <summary> /// Edit the selected exclusion expression /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnEditExpression_Click(object sender, RoutedEventArgs e) { int idx = lbExclusionExpressions.SelectedIndex; if (idx != -1) { var form = new ExclusionExpressionAddEditForm(); form.Expression = expressions[idx]; if (form.ShowDialog() ?? false) { expressions[idx] = form.Expression; string displayText = form.Expression.ToString(); if (form.Expression.Options != RegexOptions.None) { displayText += " (" + form.Expression.Options.ToString() + ")"; } lbExclusionExpressions.Items[idx] = displayText; lbExclusionExpressions.SelectedIndex = idx; Property_Changed(sender, e); } } else if (lbExclusionExpressions.Items.Count != 0) { lbExclusionExpressions.SelectedIndex = 0; } }
//===================================================================== /// <summary> /// Add a new exclusion expression /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAddExpression_Click(object sender, RoutedEventArgs e) { var form = new ExclusionExpressionAddEditForm(); if (form.ShowDialog() ?? false) { expressions.Add(form.Expression); string displayText = form.Expression.ToString(); if (form.Expression.Options != RegexOptions.None) { displayText += " (" + form.Expression.Options.ToString() + ")"; } lbExclusionExpressions.SelectedIndex = lbExclusionExpressions.Items.Add(displayText); btnEditExpression.IsEnabled = btnRemoveExpression.IsEnabled = true; Property_Changed(sender, e); } }
/// <summary> /// Edit the selected exclusion expression /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnEditExpression_Click(object sender, RoutedEventArgs e) { int idx = lbExclusionExpressions.SelectedIndex; if(idx != -1) { var form = new ExclusionExpressionAddEditForm(); form.Expression = expressions[idx]; if(form.ShowDialog() ?? false) { expressions[idx] = form.Expression; string displayText = form.Expression.ToString(); if(form.Expression.Options != RegexOptions.None) displayText += " (" + form.Expression.Options.ToString() + ")"; lbExclusionExpressions.Items[idx] = displayText; lbExclusionExpressions.SelectedIndex = idx; Property_Changed(sender, e); } } else if(lbExclusionExpressions.Items.Count != 0) lbExclusionExpressions.SelectedIndex = 0; }
//===================================================================== /// <summary> /// Add a new exclusion expression /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAddExpression_Click(object sender, RoutedEventArgs e) { var form = new ExclusionExpressionAddEditForm(); if(form.ShowDialog() ?? false) { expressions.Add(form.Expression); string displayText = form.Expression.ToString(); if(form.Expression.Options != RegexOptions.None) displayText += " (" + form.Expression.Options.ToString() + ")"; lbExclusionExpressions.SelectedIndex = lbExclusionExpressions.Items.Add(displayText); btnEditExpression.IsEnabled = btnRemoveExpression.IsEnabled = true; Property_Changed(sender, e); } }