private void btnEdit_Click(object sender, RoutedEventArgs e) { try { if (dtgUsers.SelectedItem != null) { User oUser = (User)dtgUsers.SelectedItem; ucAddEditUser oucAddEditUser = new ucAddEditUser(oUser, true); winDialog oDialog = new winDialog(oucAddEditUser) { ShowInTaskbar = true, WindowTitle = "Edit User", Height = 300, Width = 390 }; oDialog.ShowDialog(); dtgUsers.Items.Refresh(); } else { MessageBox.Show("Please select a user from list"); } } catch (Exception) { MessageBox.Show("Can not edit user now"); } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { try { if (dtgItems.SelectedItem != null) { PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem; ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail, true); winDialog oDialog = new winDialog(oucAddEditPartsDetail) { ShowInTaskbar = true, WindowTitle = "Edit Parts", Height = 240, Width = 560 }; oDialog.ShowDialog(); dtgItems.Items.Refresh(); } else { MessageBox.Show("Please select a parts"); } } catch (Exception) { MessageBox.Show("Can not add parts"); } }
private void dtgItems_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { if (dtgItems.SelectedItem != null) { PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem; winDialog oDialog = new winDialog(new ucDelivery(oPartsDetail)) { ShowInTaskbar = false, Height = 530, Width = 600 }; oDialog.ShowDialog(); dtgItems.Items.Refresh(); } else { MessageBox.Show("Please select a tool"); } } catch (Exception) { MessageBox.Show("Can not use part"); } }
private void OpenUsePartWindow() { try { if (dtgItems.SelectedItem != null) { PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem; winDialog oDialog = new winDialog(new ucDelivery(oPartsDetail)) { ShowInTaskbar = true, WindowTitle = "Use tool in car", Height = 530, Width = 600 }; oDialog.ShowDialog(); dtgItems.Items.Refresh(); } else { MessageBox.Show("Please select a part"); } } catch (Exception) { MessageBox.Show("Can not use part"); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { Category oCategory= new Category(); ucAddEditCategory oucAddEditCategory = new ucAddEditCategory(oCategory, false); winDialog oDialog = new winDialog(oucAddEditCategory) { ShowInTaskbar = true, WindowTitle = "Add a new Category", Height = 170, Width = 500 }; oDialog.ShowDialog(); UpdateDataGrid(); } catch (Exception) { MessageBox.Show("Can not open window to add category"); } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { try { if (dtgCategories.SelectedItem != null) { Category oCategory = dtgCategories.SelectedItem as Category; ucAddEditCategory oucAddEditCategory = new ucAddEditCategory(oCategory, true); winDialog oDialog = new winDialog(oucAddEditCategory) { ShowInTaskbar = true, WindowTitle = "Edit Category", Height = 170, Width = 500 }; oDialog.ShowDialog(); UpdateDataGrid(); } else { MessageBox.Show("Please select a category from grid"); } } catch (Exception) { MessageBox.Show("Can not open window to edit category"); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { Manufacturer oManufacturer = new Manufacturer(); ucAddEditManufacturer oucAddEditManufacturer = new ucAddEditManufacturer(oManufacturer, false); winDialog oDialog = new winDialog(oucAddEditManufacturer) { ShowInTaskbar = true, WindowTitle = "Add a new Manufacturer", Height = 170, Width = 500 }; oDialog.ShowDialog(); UpdateDataGrid(); } catch (Exception) { MessageBox.Show("Can not open window to add manufacturer"); } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { try { if (dtgCarModels.SelectedItem != null) { CarModel oCarModel = dtgCarModels.SelectedItem as CarModel; ucAddEditCarModel oucAddEditCarModel = new ucAddEditCarModel(oCarModel, true); winDialog oDialog = new winDialog(oucAddEditCarModel) { ShowInTaskbar = true, WindowTitle = "Edit Car Model", Height = 200, Width = 500 }; oDialog.ShowDialog(); UpdateDataGrid(); } else { MessageBox.Show("Please select a car model"); } } catch (Exception) { MessageBox.Show("Can not open window to edit car model"); } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { try { if (dtgManufacturer.SelectedItem != null) { Manufacturer oManufacturer = dtgManufacturer.SelectedItem as Manufacturer; ucAddEditManufacturer oucAddEditManufacturer = new ucAddEditManufacturer(oManufacturer, true); winDialog oDialog = new winDialog(oucAddEditManufacturer) { ShowInTaskbar = true, WindowTitle = "Edit Manufacturer", Height = 170, Width = 500 }; oDialog.ShowDialog(); UpdateDataGrid(); } else { MessageBox.Show("Please select a manufacturer from grid"); } } catch (Exception) { MessageBox.Show("Can not open window to edit manufacturer"); } }
public static winDialog CreateDialog(string name, string caption, string content, string[] choices, Action<winDialog, int> callback) { winDialog dlg = null; if (Windows.ContainsKey(name)) { dlg = (winDialog)Windows[name]; dlg.Initialize(caption, content, choices, callback); dlg.Show(); } else { dlg = new winDialog(name, caption, content, choices, callback); Windows.Add(name, dlg); } return dlg; }
private void btnAddCar_Click(object sender, RoutedEventArgs e) { try { Car oCar = new Car(); ucAddEditCars oucAddEditCars = new ucAddEditCars(oCar, false); winDialog oDialog = new winDialog(oucAddEditCars) { ShowInTaskbar = true, WindowTitle = "Add a new Car", Height = 235, Width = 510 }; oDialog.ShowDialog(); UpdateGrid(); } catch (Exception) { MessageBox.Show("Can not open window to add car."); } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { try { Car oCar = dtgCars.SelectedItem as Car; ucAddEditCars oucAddEditCars = new ucAddEditCars(oCar, true); winDialog oDialog = new winDialog(oucAddEditCars) { ShowInTaskbar = true, WindowTitle = "Edit a Car", Height = 235, Width = 510 }; oDialog.ShowDialog(); UpdateGrid(); } catch (Exception) { MessageBox.Show("Can not open window to edit car."); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { Category oCategory = new Category(); ucAddEditCategory oucAddEditCategory = new ucAddEditCategory(oCategory, false); winDialog oDialog = new winDialog(oucAddEditCategory) { ShowInTaskbar = true, WindowTitle = "Add a new Category", Height = 170, Width = 500 }; oDialog.ShowDialog(); UpdateDataGrid(); } catch (Exception) { MessageBox.Show("Can not open window to add category"); } }
private void btnAddCarModel_Click(object sender, RoutedEventArgs e) { try { CarModel oCarModel = new CarModel(); ucAddEditCarModel oucAddEditCarModel = new ucAddEditCarModel(oCarModel, false); winDialog oDialog = new winDialog(oucAddEditCarModel) { ShowInTaskbar = true, WindowTitle = "Add a new Car Model", Height = 200, Width = 500 }; oDialog.ShowDialog(); UpdateDataGrid(); } catch (Exception) { MessageBox.Show("Can not open window to add car model"); } }
private void btnAddPartsDetail_Click(object sender, RoutedEventArgs e) { try { PartsDetail oPartsDetail = new PartsDetail(); ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail, false); winDialog oDialog = new winDialog(oucAddEditPartsDetail) { ShowInTaskbar = true, WindowTitle = "Add a new Parts", Height = 240, Width = 560 }; oDialog.ShowDialog(); dtgItems.Items.Refresh(); } catch (Exception) { MessageBox.Show("Can not add parts"); } }
private void btnAddUser_Click(object sender, RoutedEventArgs e) { try { User oUser = new User(); ucAddEditUser oucAddEditUser = new ucAddEditUser(oUser, false); winDialog oDialog = new winDialog(oucAddEditUser) { ShowInTaskbar = true, WindowTitle = "Add a new User", Height = 300, Width = 390 }; oDialog.ShowDialog(); dtgUsers.Items.Refresh(); } catch (Exception) { MessageBox.Show("Can not add user now"); } }
private void btnAddUser_Click(object sender, RoutedEventArgs e) { try { User oUser= new User(); ucAddEditUser oucAddEditUser = new ucAddEditUser(oUser, false); winDialog oDialog = new winDialog(oucAddEditUser) { ShowInTaskbar = true, WindowTitle = "Add a new User", Height = 300, Width = 390 }; oDialog.ShowDialog(); dtgUsers.Items.Refresh(); } catch (Exception) { MessageBox.Show("Can not add user now"); } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { try { if (dtgManufacturer.SelectedItem != null) { Manufacturer oManufacturer = dtgManufacturer.SelectedItem as Manufacturer; ucAddEditManufacturer oucAddEditManufacturer = new ucAddEditManufacturer(oManufacturer, true); winDialog oDialog = new winDialog(oucAddEditManufacturer) { ShowInTaskbar = true, WindowTitle = "Edit Manufacturer", Height = 170, Width = 500 }; oDialog.ShowDialog(); UpdateDataGrid(); } else MessageBox.Show("Please select a manufacturer from grid"); } catch (Exception) { MessageBox.Show("Can not open window to edit manufacturer"); } }
private void btnAddPartsDetail_Click(object sender, RoutedEventArgs e) { try { PartsDetail oPartsDetail = new PartsDetail(); ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail,false); winDialog oDialog = new winDialog(oucAddEditPartsDetail) { ShowInTaskbar = true, WindowTitle = "Add a new Parts", Height = 240, Width = 560 }; oDialog.ShowDialog(); dtgItems.Items.Refresh(); } catch (Exception) { MessageBox.Show("Can not add parts"); } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { try { if (dtgCategories.SelectedItem != null) { Category oCategory = dtgCategories.SelectedItem as Category; ucAddEditCategory oucAddEditCategory = new ucAddEditCategory(oCategory, true); winDialog oDialog = new winDialog(oucAddEditCategory) { ShowInTaskbar = true, WindowTitle = "Edit Category", Height = 170, Width = 500 }; oDialog.ShowDialog(); UpdateDataGrid(); } else MessageBox.Show("Please select a category from grid"); } catch (Exception) { MessageBox.Show("Can not open window to edit category"); } }