//edit the chosen customer private void btn_editcustomer_Click(object sender, RoutedEventArgs e) { dynamic selected = lv_Customers.SelectedItem; //if no customer chosen then display error message if (selected == null) { MessageBox.Show("You haven't selected a customer to edit."); return; } int custRef = 0; custRef = selected.CustomerRef; Customer customer = customerlist.Find(x => x.CustomerRef == custRef); var newWindow = new CustomerWindow(this, customer); newWindow.ShowDialog(); }
//When the add customer button is pressed open an add customer window and pass through the mainwindow private void btn_addcustomer_Click(object sender, RoutedEventArgs e) { var newWindow = new CustomerWindow(this); newWindow.ShowDialog(); }