Inheritance: PhotoStoreDemo.PrintBase
示例#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;
                }
            }
        }
示例#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;
     }
 }