Exemple #1
0
        /// <summary>
        /// Handles what happens when the Drink button is clicked.
        /// </summary>
        /// <param name="sender">The object being clicked.</param>
        /// <param name="e">The RoutedEventArgs.</param>
        private void DrinkClick(object sender, RoutedEventArgs e)
        {
            DrinkSelection page = new DrinkSelection();

            page.SetReturnPage(this);
            page.SetEditedDrink(_combo.Drink);
            NavigationService.Navigate(page);
        }
Exemple #2
0
 public void DrinkClick(object sender, RoutedEventArgs args)
 {
     if (DataContext is Order order)
     {
         if (CollectionViewSource.GetDefaultView(order.Items).CurrentItem is CretaceousCombo com)
         {
             DrinkSelection s = new DrinkSelection();
             s.fromCombo = true;
             NavigationService.Navigate(s);
         }
     }
 }
        /// <summary>
        /// Instantiates the MainWindow
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            selectionMenu   = new SelectionMenu(this);
            entreeSelection = new EntreeSelection(this);
            sideSelection   = new SideSelection(this);
            drinkSelection  = new DrinkSelection(this);
            customizeMenu   = new CustomizeItem(this);

            windowControl.Content = selectionMenu;
        }
        public void CherryClick(object sender, RoutedEventArgs args)
        {
            if (DataContext is Order order)
            {
                if (CollectionViewSource.GetDefaultView(order.Items).CurrentItem is Sodasaurus soda)
                {
                    soda.Flavor = SodasaurusFlavor.Cherry;
                    DrinkSelection d = new DrinkSelection();

                    d.addLemonButton.Visibility = Visibility.Collapsed;
                    d.creamButton.Visibility    = Visibility.Collapsed;
                    d.decafButton.Visibility    = Visibility.Collapsed;
                    d.sweetButton.Visibility    = Visibility.Collapsed;
                    d.flavorButton.Visibility   = Visibility.Visible;
                    NavigationService.Navigate(d);
                }
            }
        }
 /// <summary>
 /// Constructs the flavor selection page for a given drink
 /// </summary>
 /// <param name="d">The drink page that constructed the flavor selection page</param>
 public FlavorSelection(DrinkSelection d)
 {
     InitializeComponent();
     drink = d;
 }
Exemple #6
0
        /// <summary>
        /// Determines what happens when the selected object is changed.
        /// </summary>
        /// <param name="sender">The ListBox that is being updated.</param>
        /// <param name="e">The SelectionChagedEventArgs of the selection change.</param>
        public void SelectionChange(object sender, SelectionChangedEventArgs e)
        {
            ListBox buff = sender as ListBox;

            if (selectedItem != null)
            {
                if (uxListBox != buff)
                {
                    uxListBox.SelectedItem = null;
                }
            }

            uxListBox = buff;

            if (e.AddedItems.Count > 0)
            {
                selectedItem = e.AddedItems[0] as IOrderItem;
            }

            if (selectedItem != lastSelectedItem)
            {
                if (selectedItem is Entree entree)
                {
                    //Console.WriteLine("Selected an entree");
                    CustomizeEntree page = new CustomizeEntree();
                    page.InitPage(entree, new MenuCategorySelection());
                    page.SetEditedEntree(entree);
                    MainWindow window = Window.GetWindow(this) as MainWindow;
                    window.GetCurrentPage().NavigationService.Navigate(page);
                }
                else if (selectedItem is Side side)
                {
                    //Console.WriteLine("Selected a side");
                    SideSelection page = new SideSelection();
                    page.SetEditedSide(side, new MenuCategorySelection());
                    MainWindow window = Window.GetWindow(this) as MainWindow;
                    window.GetCurrentPage().NavigationService.Navigate(page);
                }
                else if (selectedItem is Drink drink)
                {
                    //Console.WriteLine("Selected a drink");
                    DrinkSelection page = new DrinkSelection();
                    page.SetReturnPage(new MenuCategorySelection());
                    page.SetEditedDrink(drink);
                    MainWindow window = Window.GetWindow(this) as MainWindow;
                    window.GetCurrentPage().NavigationService.Navigate(page);
                }
                else if (selectedItem is CretaceousCombo combo)
                {
                    //Console.WriteLine("Selected a combo");
                    CustomizeCombo page = new CustomizeCombo();
                    page.SetReturnPage(new MenuCategorySelection());
                    Console.WriteLine("Combo size: " + combo.Size);
                    page.SetCombo(combo);
                    MainWindow window = Window.GetWindow(this) as MainWindow;
                    window.GetCurrentPage().NavigationService.Navigate(page);
                }
            }

            lastSelectedItem = selectedItem;
        }
        private void OrderScreen_DrinkClick(object sender, OrderClickEventArgs e)
        {
            DrinkSelection drinkPage = new DrinkSelection(e.SelectedItem as Drink, true, e.Index);

            OrderWindow.Navigate(drinkPage);
        }
        /// <summary>
        /// Navigates to the desired window
        /// </summary>
        /// <param name="sender"> sends where it was clicked</param>
        /// <param name="e">and the event argument</param>
        private void Button_Click3(object sender, RoutedEventArgs e)
        {
            DrinkSelection s = new DrinkSelection();

            NavigationService.Navigate(s);
        }