private void buttonNew_Click(object sender, EventArgs e) { Button buttonOrigin = (Button)sender; clientVM.SetDisplayClient(new Client(String.Empty, String.Empty, string.Empty, string.Empty, "<Select Province>", string.Empty, 0.0m, false, String.Empty)); using (ClientEditDialog ced = new ClientEditDialog()) { ced.ClientVM = clientVM; ced.callingButton = buttonOrigin.Text; ced.ShowDialog(); bgw.RunWorkerAsync(); } }
/// <summary> /// Setup viewModel and open Modal Form with the current record data; /// </summary> private void displayClient() { currentIndex = dataGridViewClients.CurrentRow.Index; Client client = clientVM.Clients[currentIndex]; clientVM.SetDisplayClient(client); using (ClientEditDialog ced = new ClientEditDialog()) { ced.ClientVM = clientVM; if (ced.ShowDialog() == DialogResult.OK) { bgw.RunWorkerAsync(); refreshStatsPanel(); } } }