예제 #1
0
        /// <summary>
        /// Handles baked beans button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddBakedBeans_Click(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();
            var item         = new BakedBeans();
            var screen       = new SideCustomizations();

            screen.DataContext = item;

            if (DataContext is Order data)
            {
                data.Add(item);
            }
            orderControl.SwapScreen(screen);
        }
        public void ChangeExistingItem(object sender, SelectionChangedEventArgs e)
        {
            var ancestor = this.FindAncestor <OrderControl>();

            if (ancestor == null)
            {
                return;
            }

            foreach (object i in e.AddedItems)
            {
                if (i is AngryChicken)
                {
                    var screen = new AngryChickenCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is CowboyCoffee)
                {
                    var screen = new CowboyCoffeCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is CowpokeChili)
                {
                    var screen = new CowpokeChiliCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is DakotaDoubleBurger)
                {
                    var screen = new DakotaDoubleCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is JerkedSoda)
                {
                    var screen = new JerkedSodaCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is PecosPulledPork)
                {
                    var screen = new PecosPulledPorkCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is PanDeCampo || i is BakedBeans || i is ChiliCheeseFries || i is CornDodgers)
                {
                    var screen = new SideCustomizations();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is CowpokeChili)
                {
                    var screen = new CowpokeChiliCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is TexasTea)
                {
                    var screen = new TexasTeaCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is TexasTripleBurger)
                {
                    var screen = new TexasTripleCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is TrailBurger)
                {
                    var screen = new TrailBurgerCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is Water)
                {
                    var screen = new WaterCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
            }
        }
예제 #3
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);
                            }
                        }
                    }
                }
            }
        }
예제 #4
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;
                    }
                }
            }
        }