/// <summary> /// Validates input and adds the rule to the ListOfRules. /// Displays warning if validation fails. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddRule_Click(object sender, EventArgs e) { Stage stage; if (authButton.Checked) { stage = Stage.Authentication; } else if (authZButton.Checked) { stage = Stage.Authorization; } else if (gatewayButton.Checked) { stage = Stage.Gateway; } else { MessageBox.Show("Authentication, Authorization or Gateway button must be checked."); return; } string action = (string)actionBox.SelectedItem; string val1 = textBox1.Text; string val2 = (textBox2.Enabled ? textBox2.Text : null); try { IUsernameRule rule = ListOfRules.CreateRule(stage, action, val1, val2); rules.Add(rule); updateListView(); } catch (UsernameModPluginException ex) { MessageBox.Show(ex.Message); } }