Example #1
0
        /// <summary>
        /// when an item in the order list is clicked
        /// it will return to the customization screen if it
        /// can be customized
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnItemClick(object sender, SelectionChangedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (sender is ListBox list)
            {
                if (list.SelectedItem is IOrderItem item)
                {
                    if (item is AngryChicken chicken)
                    {
                        var screen = new CustomizeAngryChicken();
                        screen.DataContext = chicken;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                    else if (item is CowpokeChili chili)
                    {
                        var screen = new CustomizeCowpokeChili();
                        screen.DataContext = chili;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                    else if (item is DakotaDoubleBurger dakota)
                    {
                        var screen = new CustomizeDakotaDouble();
                        screen.DataContext = dakota;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                    else if (item is PecosPulledPork pork)
                    {
                        var screen = new CustomizePecosPulledPork();
                        screen.DataContext = pork;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                    else if (item is TexasTripleBurger triple)
                    {
                        var screen = new CustomizeTexasTriple();
                        screen.DataContext = triple;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                    else if (item is TrailBurger trail)
                    {
                        var screen = new CustomizeTrailBurger();
                        screen.DataContext = trail;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                    else if (item is BakedBeans || item is CornDodgers || item is ChiliCheeseFries || item is PanDeCampo)
                    {
                        var screen = new CustomizeSide();
                        screen.DataContext = item;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                    else if (item is CowboyCoffee coffee)
                    {
                        var screen = new CustomizeCowboyCoffee();
                        screen.DataContext = item;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                    else if (item is JerkedSoda)
                    {
                        var screen = new CustomizeJerkedSoda();
                        screen.DataContext = item;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                    else if (item is TexasTea)
                    {
                        var screen = new CustomizeTexasTea();
                        screen.DataContext = item;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                    else if (item is Water)
                    {
                        var screen = new CustomizeWater();
                        screen.DataContext = item;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl.SwapScreen(screen);
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// whenver a button is clicked this will run switches for
        /// tags on the button names to find which item to add
        /// to the order list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    case "CowpokeChili":
                        var item   = new CowpokeChili();
                        var screen = new CustomizeCowpokeChili();
                        AddItemAndOpenCustomizationScreen(item, screen);

                        //var entree = new CowpokeChili();
                        //order.Add(entree);
                        //var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        //order.Add(entree);
                        //orderControl.SwapScreen(screen);
                        break;

                    case "AngryChicken":
                        var chicken       = new AngryChicken();
                        var chickenScreen = new CustomizeAngryChicken();
                        AddItemAndOpenCustomizationScreen(chicken, chickenScreen);

                        break;

                    case "DakotaDouble":
                        var dakota       = new DakotaDoubleBurger();
                        var dakotaScreen = new CustomizeDakotaDouble();
                        AddItemAndOpenCustomizationScreen(dakota, dakotaScreen);

                        break;

                    case "RustlersRibs":
                        order.Add(new RustlersRibs());

                        break;

                    case "TexasTriple":
                        var texas       = new TexasTripleBurger();
                        var texasScreen = new CustomizeTexasTriple();
                        AddItemAndOpenCustomizationScreen(texas, texasScreen);

                        break;

                    case "PecosPulledPork":
                        var pork       = new PecosPulledPork();
                        var porkScreen = new CustomizePecosPulledPork();
                        AddItemAndOpenCustomizationScreen(pork, porkScreen);

                        break;

                    case "TrailBurger":
                        var trail       = new TrailBurger();
                        var trailScreen = new CustomizeTrailBurger();
                        AddItemAndOpenCustomizationScreen(trail, trailScreen);

                        break;

                    case "ChiliCheeseFries":
                        var fries       = new ChiliCheeseFries();
                        var friesScreen = new CustomizeSide();
                        AddItemAndOpenCustomizationScreen(fries, friesScreen);

                        break;

                    case "PanDeCampo":
                        var panDeCampo       = new PanDeCampo();
                        var panDeCampoScreen = new CustomizeSide();
                        AddItemAndOpenCustomizationScreen(panDeCampo, panDeCampoScreen);

                        break;

                    case "BakedBeans":
                        var beans       = new BakedBeans();
                        var beansScreen = new CustomizeSide();
                        AddItemAndOpenCustomizationScreen(beans, beansScreen);

                        break;

                    case "CornDodgers":
                        var dodgers       = new CornDodgers();
                        var dodgersScreen = new CustomizeSide();
                        AddItemAndOpenCustomizationScreen(dodgers, dodgersScreen);

                        break;

                    case "Water":
                        var water       = new Water();
                        var waterScreen = new CustomizeWater();
                        AddItemAndOpenCustomizationScreen(water, waterScreen);

                        break;

                    case "CowboyCoffee":
                        var coffee       = new CowboyCoffee();
                        var coffeeScreen = new CustomizeCowboyCoffee();
                        AddItemAndOpenCustomizationScreen(coffee, coffeeScreen);

                        break;

                    case "TexasTea":
                        var tea       = new TexasTea();
                        var teaScreen = new CustomizeTexasTea();
                        AddItemAndOpenCustomizationScreen(tea, teaScreen);

                        break;

                    case "JerkedSoda":
                        var soda       = new JerkedSoda();
                        var sodaScreen = new CustomizeJerkedSoda();
                        AddItemAndOpenCustomizationScreen(soda, sodaScreen);

                        break;

                    default:
                        break;
                    }
                }
            }
        }