Inheritance: PhotoStoreDemo.PrintBase
Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
 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;
     }
 }