Esempio n. 1
0
        /// <summary>
        /// Opens corresponding customization screen when item is clicked on
        /// </summary>
        /// <param name="sender">Button containing item in summary display</param>
        /// <param name="args">Arguments</param>
        private void OnRecustomizeClick(object sender, RoutedEventArgs args)
        {
            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    if (button.DataContext is IOrderItem item)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();

                        if (item is Entree entree)
                        {
                            if (entree is AngryChicken angryChicken)
                            {
                                var screen = new AngryChickenCustomizations();
                                screen.DataContext = angryChicken;
                                orderControl?.SwapScreen(screen);
                            }
                            else if (entree is CowpokeChili cowpokeChili)
                            {
                                var screen = new CowpokeChiliCustomizations();
                                screen.DataContext = cowpokeChili;
                                orderControl?.SwapScreen(screen);
                            }
                            else if (entree is DakotaDoubleBurger dakotaDoubleBurger)
                            {
                                var screen = new DakotaDoubleBurgerCustomizations();
                                screen.DataContext = dakotaDoubleBurger;
                                orderControl?.SwapScreen(screen);
                            }
                            else if (entree is PecosPulledPork pecosPulledPork)
                            {
                                var screen = new PecosPulledPorkCustomizations();
                                screen.DataContext = pecosPulledPork;
                                orderControl?.SwapScreen(screen);
                            }
                            else if (entree is TexasTripleBurger texasTripleBurger)
                            {
                                var screen = new TexasTripleBurgerCustomizations();
                                screen.DataContext = texasTripleBurger;
                                orderControl?.SwapScreen(screen);
                            }
                            else if (entree is TrailBurger trailBurger)
                            {
                                var screen = new TrailBurgerCustomizations();
                                screen.DataContext = trailBurger;
                                orderControl?.SwapScreen(screen);
                            }
                        }

                        else if (item is Side side)
                        {
                            string tag;
                            if (side is BakedBeans)
                            {
                                tag = "Baked Beans";
                            }
                            else if (side is ChiliCheeseFries)
                            {
                                tag = "Chili Cheese Fries";
                            }
                            else if (side is CornDodgers)
                            {
                                tag = "Corn Dodgers";
                            }
                            else
                            {
                                tag = "Pan De Campo";
                            }

                            var screen = new SideCustomizations(tag);
                            screen.DataContext = side;
                            orderControl?.SwapScreen(screen);
                        }

                        else if (item is Drink drink)
                        {
                            if (drink is CowboyCoffee cowboyCoffee)
                            {
                                var screen = new CowboyCoffeeCustomizations();
                                screen.DataContext = cowboyCoffee;
                                orderControl?.SwapScreen(screen);
                            }
                            else if (drink is JerkedSoda jerkedSoda)
                            {
                                var screen = new JerkedSodaCustomizations();
                                screen.DataContext = jerkedSoda;
                                orderControl?.SwapScreen(screen);
                            }
                            else if (drink is TexasTea texasTea)
                            {
                                var screen = new TexasTeaCustomizations();
                                screen.DataContext = texasTea;
                                orderControl?.SwapScreen(screen);
                            }
                            else if (drink is Water water)
                            {
                                var screen = new WaterCustomizations();
                                screen.DataContext = water;
                                orderControl?.SwapScreen(screen);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Adds item to order, based on sender Button's tag
        /// </summary>
        /// <param name="sender">Button</param>
        /// <param name="args">Arguments</param>
        void OnAddOrderItemButtonClicked(object sender, RoutedEventArgs args)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    //Entrees
                    case "AngryChicken":
                    {
                        var item   = new AngryChicken();
                        var screen = new AngryChickenCustomizations();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "CowpokeChili":
                    {
                        var item   = new CowpokeChili();
                        var screen = new CowpokeChiliCustomizations();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "DakotaDoubleBurger":
                    {
                        var item   = new DakotaDoubleBurger();
                        var screen = new DakotaDoubleBurgerCustomizations();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "PecosPulledPork":
                    {
                        var item   = new PecosPulledPork();
                        var screen = new PecosPulledPorkCustomizations();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "RustlersRibs":
                    {
                        var item = new RustlersRibs();
                        order.Add(item);
                    }
                    break;

                    case "TexasTripleBurger":
                    {
                        var item   = new TexasTripleBurger();
                        var screen = new TexasTripleBurgerCustomizations();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "TrailBurger":
                    {
                        var item   = new TrailBurger();
                        var screen = new TrailBurgerCustomizations();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    //Sides
                    case "BakedBeans":
                    {
                        var item   = new BakedBeans();
                        var screen = new SideCustomizations("Baked Beans");
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "ChiliCheeseFries":
                    {
                        var item   = new ChiliCheeseFries();
                        var screen = new SideCustomizations("Chili Cheese Fries");
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "CornDodgers":
                    {
                        var item   = new CornDodgers();
                        var screen = new SideCustomizations("Corn Dodgers");
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "PanDeCampo":
                    {
                        var item   = new PanDeCampo();
                        var screen = new SideCustomizations("Pan De Campo");
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    // Drinks
                    case "CowboyCoffee":
                    {
                        var item   = new CowboyCoffee();
                        var screen = new CowboyCoffeeCustomizations();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "JerkedSoda":
                    {
                        var item   = new JerkedSoda();
                        var screen = new JerkedSodaCustomizations();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "TexasTea":
                    {
                        var item   = new TexasTea();
                        var screen = new TexasTeaCustomizations();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;

                    case "Water":
                    {
                        var item   = new Water();
                        var screen = new WaterCustomizations();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                    }
                    break;
                    }
                }
            }
        }