/// <summary> /// Run when the save button is hit. If an error is encountered due to improper input, /// a prompt will be shown and the save/exit will be cancelled. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { rules.Save(); } catch (UsernameModPluginException ex) { MessageBox.Show("Unable to save settings.\n{0}", ex.Message); return; } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }