private void AddToShoppingCart(object sender, RoutedEventArgs e) { if (PrintTypeComboBox.SelectedItem != null) { PrintBase item; switch (PrintTypeComboBox.SelectedIndex) { case 0: item = new Print(CurrentPhoto.Source as BitmapSource); break; case 1: item = new GreetingCard(CurrentPhoto.Source as BitmapSource); break; case 2: item = new Shirt(CurrentPhoto.Source as BitmapSource); break; default: return; } ShoppingCart.Add(item); ShoppingCartListBox.ScrollIntoView(item); ShoppingCartListBox.SelectedItem = item; if (false == UploadButton.IsEnabled) { UploadButton.IsEnabled = true; } if (false == RemoveButton.IsEnabled) { RemoveButton.IsEnabled = true; } } }
private void AddToPhotoTray(object sender, RoutedEventArgs e) { if (PrintTypeComboBox.SelectedItem != null) { foreach (Photo p in PhotosListBox.SelectedItems) { Print print = GetPrintFromPhotoTray(p, PrintTypeComboBox.SelectedItem as PrintType); if (print != null) { print.Quantity++; } else { print = new Print(p, PrintTypeComboBox.SelectedItem as PrintType, 1); PhotoTray.Add(print); } } } }