private void BtnEdit_Click(object sender, RoutedEventArgs e) { if (itemLoaded) { Window editWindow; switch (cboItemType.SelectedItem.ToString()) { case "Computer": editWindow = new EditComputer((Computer)currentItem, opts, lblActiveItem.Content.ToString()); break; case "Part": editWindow = new EditPart((Part)currentItem, opts, lblActiveItem.Content.ToString()); break; default: editWindow = new EditItem((Item)currentItem, opts); break; } editWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; editWindow.Show(); } }
private void BtnNew_Click(object sender, RoutedEventArgs e) { Window editWindow; switch (cboItemType.SelectedItem.ToString()) { case "Computer": editWindow = new EditComputer(new Computer(), opts, ""); break; case "Part": editWindow = new EditPart(new Part(), opts, ""); break; default: editWindow = new EditItem(new Item(), opts); break; } editWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; editWindow.Show(); }