private void DataJobsAddButton_Click(object sender, EventArgs e) { using DataJobForm form = new DataJobForm(); if (form.ShowDialog() == DialogResult.OK) { Properties.Settings.Default.DataJobs.Add(form.DataJob); } }
private void DataJobsEdit() { using DataJobForm form = new DataJobForm { DataJob = (DataJob)dataJobsGrid.SelectedRows[0].DataBoundItem }; var index = Properties.Settings.Default.DataJobs.IndexOf((DataJob)dataJobsGrid.SelectedRows[0].DataBoundItem); if (form.ShowDialog() == DialogResult.OK) { Properties.Settings.Default.DataJobs.RemoveAt(index); Properties.Settings.Default.DataJobs.Insert(index, form.DataJob); } dataJobsGrid.Rows[index].Selected = true; }