Esempio n. 1
0
        /// <summary>
        /// Handles what happens when the Side button is clicked.
        /// </summary>
        /// <param name="sender">The object being clicked.</param>
        /// <param name="e">The RoutedEventArgs.</param>
        private void SideClick(object sender, RoutedEventArgs e)
        {
            SideSelection page = new SideSelection();

            page.SetEditedSide(_combo.Side, this);
            NavigationService.Navigate(page);
        }
Esempio n. 2
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;
        }