private void buttonAdd_Click(object sender, EventArgs e) { var counter = new Counter(); var form = new AddEditCounterForm(counter, AddEditCounterForm.Action.Add); var result = form.ShowDialog(this); if (result == DialogResult.OK) { Settings.Instance.Counters.Add(counter); } }
private void buttonEdit_Click(object sender, EventArgs e) { var counter = GetSelectedCounter(); if (counter != null) { var form = new AddEditCounterForm(counter, AddEditCounterForm.Action.Edit); form.ShowDialog(this); } RefreshDatagrid(); }