Esempio n. 1
0
        /// <summary>
        /// Listener for the click event of the Dakota Double Burger Button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnAddDakotaDoubleBurgerButton_Clicked(object sender, RoutedEventArgs e)
        {
            DakotaDoubleBurger d = new DakotaDoubleBurger();
            var screen           = new CustomizeDakotaDoubleBurger();

            AddItemAndOpenCustomizationScreen(d, screen);
        }
Esempio n. 2
0
 /// <summary>
 /// Click event handler for Dakota Double Burger Button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnAddDakotaDoubleBurgerButtonClicked(object sender, RoutedEventArgs e)
 {
     if (DataContext is Order data)
     {
         var item   = new DakotaDoubleBurger();
         var screen = new CustomizeDakotaDoubleBurger();
         AddItemAndOpenCustomization(item, screen);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Adds Dakota Double Burger to order list when corresponding button is pushed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnDakotaDoubleBurgerAdded(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order data)
            {
                var entree = new DakotaDoubleBurger();
                var screen = new CustomizeDakotaDoubleBurger();
                AddItemAndOpenCustomizationScreen(entree, screen);
            }
        }
        /// <summary>
        /// Adds Item to the order
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnAddDakotaDoubleBurgerButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order data) // checks if you can cast it and if assigns it to data
            {
                var entree = new DakotaDoubleBurger();
                var screen = new CustomizeDakotaDoubleBurger();
                AddItemAndOpenCustomizationScreen(entree, screen);
            }
        }
 /// <summary>
 /// Event handler for adding the dakota double burger entree to the order
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnAddDakotaDoubleBurgerButtonClicked(object sender, RoutedEventArgs e)
 {
     if (DataContext is Order data)
     {
         var newDakotaDouble = new DakotaDoubleBurger();
         var screen          = new CustomizeDakotaDoubleBurger();
         screen.DataContext = newDakotaDouble;
         data.Add(newDakotaDouble);
         orderControl = this.FindAncestor <OrderControl>();
         orderControl.SwapScreen(screen);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// The event handler for the dakota double burger
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AddToOrderDakotaDoubleBurger(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order data)
            {
                var entree = new DakotaDoubleBurger();
                var screen = new CustomizeDakotaDoubleBurger();
                screen.DataContext = entree;
                data.Add(new DakotaDoubleBurger());
                orderControl.SwapScreen(new CustomizeDakotaDoubleBurger());
            }
        }
Esempio n. 7
0
 /// <summary>
 /// This method adds the Dakota Double Burger to the list
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void AddDakotaDoubleBurger_Click(object sender, RoutedEventArgs e)
 {
     orderControl = this.FindAncestor <OrderControl>();
     if (DataContext is Order order)
     {
         var entree = new DakotaDoubleBurger();
         var screen = new CustomizeDakotaDoubleBurger();
         screen.DataContext = entree;
         entree.Screen      = screen;
         order.Add(entree);
         orderControl.SwapScreen(screen);
     }
 }
        /// <summary>
        /// adds dakota double burger to ordersummary control and order column on mainwindow
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnAddDakotaDoubleBurgerButtonClicked(object sender, RoutedEventArgs e)
        {
            if (DataContext is Order data) // checks if you can cast it and if assigns it to data
            {
                //data.Add(new DakotaDoubleBurger());

                var item   = new DakotaDoubleBurger();
                var screen = new CustomizeDakotaDoubleBurger();
                screen.DataContext = item;
                data.Add(item);
                //orderControl.SwapScreen(screen);
                AddItemandOpenCustomizationScreen(item, screen);
            }
        }
        /// <summary>
        /// Adds item
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void itemSelected(object sender, SelectionChangedEventArgs args)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (orderControl == null)
            {
                return;
            }

            foreach (object o in args.AddedItems)
            {
                if (o is AngryChicken)
                {
                    var screen = new CustomizeAngryChicken();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is BakedBeans)
                {
                    var screen = new CustomizeSide();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is ChiliCheeseFries)
                {
                    var screen = new CustomizeChiliCheeseFries();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is CornDodgers)
                {
                    var screen = new CustomizeSide();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is CowboyCoffee)
                {
                    var screen = new CustomizeCowboyCoffee();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is CowpokeChili)
                {
                    var screen = new CustomizeCowpokeChili();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is DakotaDoubleBurger)
                {
                    var screen = new CustomizeDakotaDoubleBurger();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is JerkedSoda)
                {
                    var screen = new CustomizeJerkedSoda();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is PanDeCampo)
                {
                    var screen = new CustomizeSide();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is PecosPulledPork)
                {
                    var screen = new CustomizePecosPulledPork();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is TexasTea)
                {
                    var screen = new CustomizeTexasTea();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is TexasTripleBurger)
                {
                    var screen = new CustomizeTexasTripleBurger();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is TrailBurger)
                {
                    var screen = new CustomizeTrailBurger();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
                else if (o is Water)
                {
                    var screen = new CustomizeWater();
                    screen.DataContext = o;
                    orderControl.SwapScreen(screen);
                }
            }
        }
        /// <summary>
        /// brings up the same instance that was first used to create the item.
        /// (thus an item can be edited)
        /// </summary>
        /// <param name="sender">the button clicked</param>
        /// <param name="e">the event args</param>
        public void EditItem(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                //help.Text = ListOne.SelectedItem.ToString();
                if (ListOne.SelectedItem != null)
                {
                    var temp = ListOne.SelectedItem.ToString();
                    switch (temp)
                    {
                    case "Cowpoke Chili":
                        var cow     = (CowpokeChili)ListOne.SelectedItem;//was (CowboyCafe.Data.CustomizeCowpokeCili)ListOne.SelectedItem;
                        var cowCust = new CustomizeCowpokeChili();
                        cowCust.DataContext = cow;
                        orderControl.SwapScreen(cowCust);
                        break;

                    case "Angry Chicken":
                        var chicken     = (AngryChicken)ListOne.SelectedItem;
                        var chickenCust = new CustomizeAngryChicken();
                        chickenCust.DataContext = chicken;
                        orderControl.SwapScreen(chickenCust);
                        break;

                    case "Trail Burger":
                        var trailBurger     = (TrailBurger)ListOne.SelectedItem;
                        var trailBurgerCust = new CustomizeTrailburger();
                        trailBurgerCust.DataContext = trailBurger;
                        orderControl.SwapScreen(trailBurgerCust);
                        break;

                    //rustlers ribs does not take customizations
                    case "Pecos Pulled Pork":
                        var pecosPulledPork     = (PecosPulledPork)ListOne.SelectedItem;
                        var pecosPulledPorkCust = new CustomizePecosPulledPork();
                        pecosPulledPorkCust.DataContext = pecosPulledPork;
                        orderControl.SwapScreen(pecosPulledPorkCust);
                        break;

                    case "Dakota Double Burger":
                        var dakotaDoubleBurger     = (DakotaDoubleBurger)ListOne.SelectedItem;
                        var dakotaDoubleBurgerCust = new CustomizeDakotaDoubleBurger();
                        dakotaDoubleBurgerCust.DataContext = dakotaDoubleBurger;
                        orderControl.SwapScreen(dakotaDoubleBurgerCust);
                        break;

                    case "Texas Triple Burger":
                        var texasTripleBurger     = (TexasTripleBurger)ListOne.SelectedItem;
                        var texasTripleBurgerCust = new CustomizeTexasTripleBurger();
                        texasTripleBurgerCust.DataContext = texasTripleBurger;
                        orderControl.SwapScreen(texasTripleBurgerCust);
                        break;
                    }
                    if (ListOne.SelectedItem.ToString().Contains("Chili Cheese Fries"))
                    {
                        var chiliCheeseFries     = (ChiliCheeseFries)ListOne.SelectedItem;
                        var chiliCheeseFriesCust = new CustomizeChiliCheeseFries();
                        chiliCheeseFriesCust.DataContext = chiliCheeseFries;
                        orderControl.SwapScreen(chiliCheeseFriesCust);
                    }
                    if (temp.Contains("Corn Dodgers"))
                    {
                        var cornDodgers     = (CornDodgers)ListOne.SelectedItem;
                        var cornDodgersCust = new CustomizeCornDodgers();
                        cornDodgersCust.DataContext = cornDodgers;
                        orderControl.SwapScreen(cornDodgersCust);
                    }
                    else if (temp.Contains("Pan de Campo"))
                    {
                        var panDeCampo     = (PanDeCampo)ListOne.SelectedItem;
                        var panDeCampoCust = new CustomizePanDeCampo();
                        panDeCampoCust.DataContext = panDeCampo;
                        orderControl.SwapScreen(panDeCampoCust);
                    }
                    else if (temp.Contains("Baked Beans"))
                    {
                        var bakedBeans     = (BakedBeans)ListOne.SelectedItem;
                        var bakedBeansCust = new CustomizeBakedBeans();
                        bakedBeansCust.DataContext = bakedBeans;
                        orderControl.SwapScreen(bakedBeansCust);
                    }
                    //drinks:
                    else if (temp.Contains("Jerked Soda"))
                    {
                        var jerkedSoda     = (JerkedSoda)ListOne.SelectedItem;
                        var jerkedSodaCust = new CustomizeJerkedSoda();
                        jerkedSodaCust.DataContext = jerkedSoda;
                        orderControl.SwapScreen(jerkedSodaCust);
                    }
                    else if (temp.Contains("Tea"))
                    {
                        var tea     = (TexasTea)ListOne.SelectedItem;
                        var teaCust = new CustomizeTexasTea();
                        teaCust.DataContext = tea;
                        orderControl.SwapScreen(teaCust);
                    }
                    else if (temp.Contains("Cowboy Coffee"))
                    {
                        var cowboyCoffee     = (CowboyCoffee)ListOne.SelectedItem;
                        var cowboyCoffeeCust = new CustomizeCowboyCoffee();
                        cowboyCoffeeCust.DataContext = cowboyCoffee;
                        orderControl.SwapScreen(cowboyCoffeeCust);
                    }
                    else if (temp.Contains("Water"))
                    {
                        var water     = (Water)ListOne.SelectedItem;
                        var waterCust = new CustomizeWater();
                        waterCust.DataContext = water;
                        orderControl.SwapScreen(waterCust);
                    }
                }
            }
        }
        /// <summary>
        /// Event handler to switch the screen to the customization when item in the order is clicked
        /// </summary>
        /// <param name="sender">the item clicked</param>
        /// <param name="e">the selection changed event args</param>
        public void OnMainBoxChangeItem(object sender, SelectionChangedEventArgs e)
        {
            FrameworkElement screen = null;
            var orderControl        = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is ListBox listbox)
                {
                    if (listbox.SelectedItem is IOrderItem item)
                    {
                        if (item is CowpokeChili)
                        {
                            screen             = new CustomizeCowpokeChili();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is PecosPulledPork)
                        {
                            screen             = new CustomizePecosPulledPork();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is TrailBurger)
                        {
                            screen             = new CustomizeTrailBurger();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is DakotaDoubleBurger)
                        {
                            screen             = new CustomizeDakotaDoubleBurger();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is TexasTripleBurger)
                        {
                            screen             = new CustomizeTexasTripleBurger();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is AngryChicken)
                        {
                            screen             = new CustomizeAngryChicken();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is ChiliCheeseFries)
                        {
                            screen             = new CustomizeChiliCheeseFries();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is CornDodgers)
                        {
                            screen             = new CustomizeCornDodgers();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is PanDeCampo)
                        {
                            screen             = new CustomizePanDeCampo();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is BakedBeans)
                        {
                            screen             = new CustomizeBakedBeans();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is JerkedSoda)
                        {
                            screen             = new CustomizeJerkedSoda();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is TexasTea)
                        {
                            screen             = new CustomizeTexasTea();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is CowboyCoffee)
                        {
                            screen             = new CustomizeCowboyCoffee();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is Water)
                        {
                            screen             = new CustomizeWater();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Event handler for when an add button is clicked
        /// </summary>
        /// <param name="sender"> The button that was clicked </param>
        /// <param name="e"> The event arguments </param>
        public void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            IOrderItem       item;
            FrameworkElement screen = null;
            var orderControl        = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    case "CowpokeChili":
                        var chili       = new CowpokeChili();
                        var chiliScreen = new CustomizeCowpokeChili(DataContext);
                        AddItemAndOpenCustomizationMenu(chili, chiliScreen);
                        break;

                    case "TrailBurger":
                        var burger       = new TrailBurger();
                        var burgerScreen = new CustomizeTrailBurger(DataContext);
                        AddItemAndOpenCustomizationMenu(burger, burgerScreen);
                        break;

                    case "DakotaDouble":
                        var doubleBurger = new DakotaDoubleBurger();
                        var doubleScreen = new CustomizeDakotaDoubleBurger(DataContext);
                        AddItemAndOpenCustomizationMenu(doubleBurger, doubleScreen);
                        break;

                    case "TexasTriple":
                        var triple       = new TexasTripleBurger();
                        var tripleScreen = new CustomizeTexasTripleBurger(DataContext);
                        AddItemAndOpenCustomizationMenu(triple, tripleScreen);
                        break;

                    case "AngryChicken":
                        var chicken       = new AngryChicken();
                        var chickenScreen = new CustomizeAngryChicken(DataContext);
                        AddItemAndOpenCustomizationMenu(chicken, chickenScreen);
                        break;

                    case "PecosPulledPork":
                        var pulled       = new PecosPulledPork();
                        var pulledScreen = new CustomizePecosPulledPork(DataContext);
                        AddItemAndOpenCustomizationMenu(pulled, pulledScreen);
                        break;

                    case "RustlersRibs":
                        var ribs = new RustlersRibs();
                        order.Add(ribs);
                        break;

                    case "BakedBeans":
                        item   = new BakedBeans();
                        screen = new CustomizeBakedBeans(DataContext);
                        AddItemAndOpenCustomizationMenu(item, screen);
                        break;

                    case "ChiliCheeseFries":
                        item   = new ChiliCheeseFries();
                        screen = new CustomizeChiliCheeseFries(DataContext);
                        AddItemAndOpenCustomizationMenu(item, screen);
                        break;

                    case "CornDodgers":
                        item   = new CornDodgers();
                        screen = new CustomizeCornDodgers(DataContext);
                        AddItemAndOpenCustomizationMenu(item, screen);
                        break;

                    case "PanDeCampo":
                        item   = new PanDeCampo();
                        screen = new CustomizePanDeCampo(DataContext);
                        AddItemAndOpenCustomizationMenu(item, screen);
                        break;

                    case "CowboyCoffee":
                        item   = new CowboyCoffee();
                        screen = new CustomizeCowboyCoffee(DataContext);
                        AddItemAndOpenCustomizationMenu(item, screen);
                        break;

                    case "JerkedSoda":
                        item   = new JerkedSoda();
                        screen = new CustomizeJerkedSoda(DataContext);
                        AddItemAndOpenCustomizationMenu(item, screen);
                        break;

                    case "TexasTea":
                        item   = new TexasTea();
                        screen = new CustomizeTexasTea(DataContext);
                        AddItemAndOpenCustomizationMenu(item, screen);
                        break;

                    case "Water":
                        item   = new Water();
                        screen = new CustomizeWater(DataContext);
                        AddItemAndOpenCustomizationMenu(item, screen);
                        break;
                    }
                }
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Method that sends the Point of Sale to a customization screen for the item being editted after
        /// it had been added to the order already
        /// </summary>
        /// <param name="item">The item being editted</param>
        public void ReturnToItemScreen(IOrderItem item)
        {
            //Set the DataContext to a variable and make sure the value is not null
            var order = DataContext as Order;

            if (order == null)
            {
                throw new Exception("Datacontext expected to be an order instance");
            }

            //Create a variable for the customization control to go to and set its value based on item
            FrameworkElement screen = null;

            switch (item.GetType().Name)
            {
            case "AngryChicken":
                screen = new CustomizeAngryChicken();
                break;

            case "CowpokeChili":
                screen = new CustomizeCowpokeChili();
                break;

            case "RustlersRibs":
                screen = new CustomizeRustlersRibs();
                break;

            case "PecosPulledPork":
                screen = new CustomizePecosPulledPork();
                break;

            case "TrailBurger":
                screen = new CustomizeTrailBurger();
                break;

            case "DakotaDoubleBurger":
                screen = new CustomizeDakotaDoubleBurger();
                break;

            case "TexasTripleBurger":
                screen = new CustomizeTexasTripleBurger();
                break;

            case "ChiliCheeseFries":
                screen = new CustomizeChiliCheeseFries();
                break;

            case "CornDodgers":
                screen = new CustomizeCornDodgers();
                break;

            case "PanDeCampo":
                screen = new CustomizePanDeCampo();
                break;

            case "BakedBeans":
                screen = new CustomizeBakedBeans();
                break;

            case "CowboyCoffee":
                screen = new CustomizeCowboyCoffee();
                break;

            case "JerkedSoda":
                screen = new CustomizeJerkedSoda();
                break;

            case "TexasTea":
                screen = new CustomizeTexasTea();
                break;

            case "Water":
                screen = new CustomizeWater();
                break;

            default:
                screen = null;
                break;
            }

            //If screen was set to a value, go to that control
            if (screen != null)
            {
                screen.DataContext = item;
                SwapScreen(screen);
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Allows user to access customiztion through the list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (DataContext is Order order)
            {
                if (sender is ListView list)
                {
                    if (list.SelectedValue is IOrderItem item)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        if (orderControl == null)
                        {
                            throw new Exception("An Ancestor was not found");
                        }
                        var screen = new FrameworkElement();

                        switch (item)
                        {
                        case AngryChicken chicken:
                            screen = new CustomizeAngryChicken();
                            break;

                        case CowpokeChili chili:
                            screen = new CustomizeCowpokeChili();
                            break;

                        case TrailBurger burger:
                            screen = new CustomizeTrailBurger();
                            break;

                        case DakotaDoubleBurger burger:
                            screen = new CustomizeDakotaDoubleBurger();
                            break;

                        case PecosPulledPork Pork:
                            screen = new CustomizePekosPulledPork();
                            break;

                        case Water water:
                            screen = new CustomizeWater();
                            break;

                        case JerkedSoda soda:
                            screen = new CustomizeJerkedSoda();
                            break;

                        case TexasTea tea:
                            screen = new CustomizeTexasTea();
                            break;

                        case CowboyCoffee coffee:
                            screen = new CustomizeCowboyCoffee();
                            break;

                        case TexasTripleBurger burger:
                            screen = new CustomizeTexasTripleBurger();
                            break;

                        case Side side:
                            screen = new CustomizeSide();
                            break;
                        }
                        screen.DataContext = item;
                        orderControl.SwapScreen(screen);
                    }
                }
            }
        }
        /// <summary>
        /// Changes to the item menu that is selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnChangeSelectedItem(object sender, SelectionChangedEventArgs e)
        {
            FrameworkElement screen = null;
            var orderControl        = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is ListBox lb)
                {
                    if (lb.SelectedItem is IOrderItem item)
                    {
                        if (item is CowpokeChili)
                        {
                            screen             = new CustomizeCowpokeChili();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is AngryChicken)
                        {
                            screen             = new CustomizeAngryChicken();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is DakotaDoubleBurger)
                        {
                            screen             = new CustomizeDakotaDoubleBurger();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is PecosPulledPork)
                        {
                            screen             = new CustomizePecosPulledPork();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is TexasTripleBurger)
                        {
                            screen             = new CustomizeTexasTripleBurger();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is TrailBurger)
                        {
                            screen             = new CustomizeTrailBurger();
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is BakedBeans)
                        {
                            screen             = new CustomizeSideSize(DataContext);
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is ChiliCheeseFries)
                        {
                            screen             = new CustomizeSideSize(DataContext);
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is CornDodgers)
                        {
                            screen             = new CustomizeSideSize(DataContext);
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is PanDeCampo)
                        {
                            screen             = new CustomizeSideSize(DataContext);
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is CowboyCoffee)
                        {
                            screen             = new CustomizeCowboyCoffee(DataContext);
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is JerkedSoda)
                        {
                            screen             = new CustomizeJerkedSoda(DataContext);
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is TexasTea)
                        {
                            screen             = new CustomizeTexasTea(DataContext);
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is Water)
                        {
                            screen             = new CustomizeWater(DataContext);
                            screen.DataContext = item;
                            orderControl?.SwapScreen(screen);
                        }
                        else if (item is RustlersRibs)
                        {
                        }
                        else
                        {
                            throw new NotImplementedException("Item has not been implemented");
                        }
                    }
                }
                order.InvokePropertyChanged();
            }
        }
        /// <summary>
        /// Item seleceted event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ItemSelected(object sender, SelectionChangedEventArgs e)
        {
            IOrderItem p     = ((sender as ListBox).SelectedItem as IOrderItem);
            var        order = this.FindAncestor <OrderControl>();

            if (p is AngryChicken)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeAngryChicken();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is BakedBeans)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeBakedBeans();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is ChiliCheeseFries)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeChiliCheeseFries();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is CornDodgers)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeCornDodgers();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is CowboyCoffee)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeCowboyCoffee();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is CowpokeChili)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeCowpokeChili();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is DakotaDoubleBurger)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeDakotaDoubleBurger();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is JerkedSoda)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeJerkedSoda();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is PanDeCampo)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizePanDeCampo();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is PecosPulledPork)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizePecosPulledPork();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is RustlersRibs)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeRustlersRibs();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is TexasTea)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeTexasTea();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is TexasTripleBurger)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeTexasTripleBurger();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is TrailBurger)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeTrailBurger();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeWater();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
        }
 /// <summary>
 /// Function to toggle screen to go back to customization later on in the order process
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void ToggleScreen(object sender, RoutedEventArgs e)
 {
     if (sender is ListBox li)
     {
         if (li.SelectedItem is IOrderItem ioi)
         {
             if (ioi is AngryChicken angryChicken)
             {
                 var screen = new CustomizeAngryChicken();
                 screen.DataContext = angryChicken;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is BakedBeans bakedBeans)
             {
                 var screen = new CustomizeBakedBeans();
                 screen.DataContext = bakedBeans;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is ChiliCheeseFries chiliCheeseFries)
             {
                 var screen = new CustomizeChiliCheeseFries();
                 screen.DataContext = chiliCheeseFries;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is CornDodgers cornDodgers)
             {
                 var screen = new CustomizeCornDodgers();
                 screen.DataContext = cornDodgers;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is CowboyCoffee cowboyCoffee)
             {
                 var screen = new CustomizeCowboyCoffee();
                 screen.DataContext = cowboyCoffee;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is CowpokeChili cowpokeChili)
             {
                 var screen = new CustomizeCowpokeChili();
                 screen.DataContext = cowpokeChili;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is DakotaDoubleBurger dakotaDoubleBurger)
             {
                 var screen = new CustomizeDakotaDoubleBurger();
                 screen.DataContext = dakotaDoubleBurger;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is JerkedSoda jerkedSoda)
             {
                 var screen = new CustomizeJerkedSoda();
                 screen.DataContext = jerkedSoda;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is PanDeCampo panDeCampo)
             {
                 var screen = new CustomizePanDeCampo();
                 screen.DataContext = panDeCampo;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is PecosPulledPork pecosPulledPork)
             {
                 var screen = new CustomizePecosPulledPork();
                 screen.DataContext = pecosPulledPork;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is RustlersRibs rustlersRibs)
             {
                 var screen = new CustomizeRustlersRibs();
                 screen.DataContext = rustlersRibs;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is TexasTea texasTea)
             {
                 var screen = new CustomizeTexasTea();
                 screen.DataContext = texasTea;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is TexasTripleBurger texasTripleBurger)
             {
                 var screen = new CustomizeTexasTripleBurger();
                 screen.DataContext = texasTripleBurger;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is TrailBurger trailBurger)
             {
                 var screen = new CustomizeTrailBurger();
                 screen.DataContext = trailBurger;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (ioi is Water water)
             {
                 var screen = new CustomizeWater();
                 screen.DataContext = water;
                 orderControl       = this.FindAncestor <OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else
             {
                 return;
             }
         }
     }
 }
        /// <summary>
        /// Creates an object
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnItemAddButton_Clicked(object sender, RoutedEventArgs e)
        {
            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    var orderControl = this.FindAncestor <OrderControl>();
                    switch (button.Tag)
                    {
                    case "CowpokeChili":
                        var entreeCowpokeChili = new CowpokeChili();
                        var screenCowpokeChili = new CustomizeCowpokeChili();
                        screenCowpokeChili.DataContext = entreeCowpokeChili;
                        order.Add(entreeCowpokeChili);
                        orderControl.SwapScreen(screenCowpokeChili);
                        break;

                    case "RustlersRibs":
                        var entreeRustlersRibs = new RustlersRibs();
                        var screenRustlersRibs = new CustomizeRustlersRibs();
                        screenRustlersRibs.DataContext = entreeRustlersRibs;
                        order.Add(entreeRustlersRibs);
                        orderControl.SwapScreen(screenRustlersRibs);
                        break;

                    case "PecosPulledPork":
                        var entreePecosPulledPork = new PecosPulledPork();
                        var screenPecosPulledPork = new CustomizePecosPulledPork();
                        screenPecosPulledPork.DataContext = entreePecosPulledPork;
                        order.Add(entreePecosPulledPork);
                        orderControl.SwapScreen(screenPecosPulledPork);
                        break;

                    case "TrailBurger":
                        var entreeTrailBurger = new TrailBurger();
                        var screenTrailBurger = new CustomizeTrailBurger();
                        screenTrailBurger.DataContext = entreeTrailBurger;
                        order.Add(entreeTrailBurger);
                        orderControl.SwapScreen(screenTrailBurger);
                        break;

                    case "DakotaDoubleBurger":
                        var entreeDakotaDoubleBurger = new DakotaDoubleBurger();
                        var screenDakotaDoubleBurger = new CustomizeDakotaDoubleBurger();
                        screenDakotaDoubleBurger.DataContext = entreeDakotaDoubleBurger;
                        order.Add(entreeDakotaDoubleBurger);
                        orderControl.SwapScreen(screenDakotaDoubleBurger);
                        break;

                    case "TexasTripleBurger":
                        var entreeTexasTripleBurger = new TexasTripleBurger();
                        var screenTexasTripleBurger = new CustomizeTexasTripleBurger();
                        screenTexasTripleBurger.DataContext = entreeTexasTripleBurger;
                        order.Add(entreeTexasTripleBurger);
                        orderControl.SwapScreen(screenTexasTripleBurger);
                        break;

                    case "AngryChicken":
                        var entreeAngryChicken = new AngryChicken();
                        var screenAngryChicken = new CustomizeAngryChicken();
                        screenAngryChicken.DataContext = entreeAngryChicken;
                        order.Add(entreeAngryChicken);
                        orderControl.SwapScreen(screenAngryChicken);
                        break;

                    case "ChiliCheeseFries":
                        var sideChiliCheeseFries   = new ChiliCheeseFries();
                        var screenChiliCheeseFries = new CustomizeChiliCheeseFries();
                        screenChiliCheeseFries.DataContext = sideChiliCheeseFries;
                        order.Add(sideChiliCheeseFries);
                        orderControl.SwapScreen(screenChiliCheeseFries);
                        break;

                    case "CornDodgers":
                        var sideCornDodgers   = new CornDodgers();
                        var screenCornDodgers = new CustomizeCornDodgers();
                        screenCornDodgers.DataContext = sideCornDodgers;
                        order.Add(sideCornDodgers);
                        orderControl.SwapScreen(screenCornDodgers);
                        break;

                    case "PanDeCampo":
                        var sidePanDeCampo   = new PanDeCampo();
                        var screenPanDeCampo = new CustomizePanDeCampo();
                        screenPanDeCampo.DataContext = sidePanDeCampo;
                        order.Add(sidePanDeCampo);
                        orderControl.SwapScreen(screenPanDeCampo);
                        break;

                    case "BakedBeans":
                        var sideBakedBeans   = new BakedBeans();
                        var screenBakedBeans = new CustomizeBakedBeans();
                        screenBakedBeans.DataContext = sideBakedBeans;
                        order.Add(sideBakedBeans);
                        orderControl.SwapScreen(screenBakedBeans);
                        break;

                    case "JerkedSoda":
                        var drinkJerkedSoda  = new JerkedSoda();
                        var screenJerkedSoda = new CustomizeJerkedSoda();
                        screenJerkedSoda.DataContext = drinkJerkedSoda;
                        order.Add(drinkJerkedSoda);
                        orderControl.SwapScreen(screenJerkedSoda);
                        break;

                    case "TexasTea":
                        var drinkTexasTea  = new TexasTea();
                        var screenTexasTea = new CustomizeTexasTea();
                        screenTexasTea.DataContext = drinkTexasTea;
                        order.Add(drinkTexasTea);
                        orderControl.SwapScreen(screenTexasTea);
                        break;

                    case "CowboyCoffee":
                        var drinkCowboyCoffee  = new CowboyCoffee();
                        var screenCowboyCoffee = new CustomizeCowboyCoffee();
                        screenCowboyCoffee.DataContext = drinkCowboyCoffee;
                        order.Add(drinkCowboyCoffee);
                        orderControl.SwapScreen(screenCowboyCoffee);
                        break;

                    case "Water":
                        var drinkWater  = new Water();
                        var screenWater = new CustomizeWater();
                        screenWater.DataContext = drinkWater;
                        order.Add(drinkWater);
                        orderControl.SwapScreen(screenWater);
                        break;
                    }
                }
            }
        }
 void OnListBoxItemSelected(object sender, SelectionChangedEventArgs args)
 {
     if(sender is ListBox lb)
     {
         if(lb.SelectedItem is IOrderItem orderItem)
         {
             if(orderItem is AngryChicken ac)
             {
                 var screen = new CustomizeAngryChicken();
                 screen.DataContext = ac;
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (orderItem is CowboyCoffee c)
             {
                 var screen = new CustomizeCowboyCoffee();
                 screen.DataContext = c;
                 screen.SetButton();
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (orderItem is CowpokeChili chili)
             {
                 var screen = new CustomizeCowpokeChili();
                 screen.DataContext = chili;
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (orderItem is DakotaDoubleBurger db)
             {
                 var screen = new CustomizeDakotaDoubleBurger();
                 screen.DataContext = db;
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (orderItem is JerkedSoda soda)
             {
                 var screen = new CustomizeJerkedSoda();
                 screen.DataContext = soda;
                 screen.SetButton();
                 screen.SetFlavorButton();
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (orderItem is PecosPulledPork pork)
             {
                 var screen = new CustomizePecosPulledPork();
                 screen.DataContext = pork;
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (orderItem is Side s)
             {
                 var screen = new CustomizeSide();
                 screen.DataContext = s;
                 screen.SetButton();                    //sets the correct radio button to be checked
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (orderItem is TexasTea t)
             {
                 var screen = new CustomizeTexasTea();
                 screen.DataContext = t;
                 screen.SetButton();
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (orderItem is TexasTripleBurger triple)
             {
                 var screen = new CustomizeTexasTripleBurger();
                 screen.DataContext = triple;
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (orderItem is TrailBurger tb)
             {
                 var screen = new CustomizeTrailBurger();
                 screen.DataContext = tb;
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }
             else if (orderItem is Water w)
             {
                 var screen = new CustomizeWater();
                 screen.DataContext = w;
                 screen.SetButton();
                 orderControl = this.FindAncestor<OrderControl>();
                 orderControl.SwapScreen(screen);
             }                    
         }
     }
 }
        /// <summary>
        /// Allows the user to go back and change previously added items on the order
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="s"></param>
        void ChangeOrder(object sender, SelectionChangedEventArgs s)
        {
            var ancestor = this.FindAncestor <OrderControl>();

            if (ancestor is OrderControl)
            {
                ancestor.propChanged();
            }

            if (OrderSumControlListView.SelectedItem != null)
            {
                // curItem is the item that is selected by the user
                string curItem = OrderSumControlListView.SelectedItem.ToString();


                if (curItem != null)
                {
                    //Entrees
                    if (curItem == "Angry Chicken")
                    {
                        var screen = new CustomizeAngryChicken();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem == "Cowpoke Chili")
                    {
                        var screen = new CustomizeCowpokeChili();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem == "Dakota Double Burger")
                    {
                        var screen = new CustomizeDakotaDoubleBurger();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem == "Pecos Pulled Pork")
                    {
                        var screen = new CustomizePecosPulledPork();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem == "Rustlers Ribs")
                    {
                        var screen = new CustomizeRustlersRibs();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem == "Texas Triple Burger")
                    {
                        var screen = new CustomizeTexasTripleBurger();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem == "Trail Burger")
                    {
                        var screen = new CustomizeTrailBurger();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    // Sides
                    if (curItem.Contains("Baked Beans"))
                    {
                        var screen = new CustomizeBakedBeans();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem.Contains("Chili Cheese Fries"))
                    {
                        var screen = new CustomizeChiliCheeseFries();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem.Contains("Corn Dodgers"))
                    {
                        var screen = new CustomizeCornDodgers();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem.Contains("Pan de Campo"))
                    {
                        var screen = new CustomizePanDeCampo();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }


                    // Drinks
                    if (curItem.Contains("Cowboy Coffee"))
                    {
                        var screen = new CustomizeCowboyCoffee();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem.Contains("Jerked Soda"))
                    {
                        var screen = new CustomizeJerkedSoda();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem.Contains("Tea"))
                    {
                        var screen = new CustomizeTexasTea();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }

                    if (curItem.Contains("Water"))
                    {
                        var screen = new CustomizeWater();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }
                }
            }
        }
        /// <summary>
        /// Updates the screen to the item selected customize screen
        /// </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 entree = new CowpokeChili();
                        var screen = new CustomizeCowpokeChili();
                        screen.DataContext = entree;
                        order.Add(entree);
                        orderControl.SwapScreen(screen);
                        break;

                    case "RustlersRibs":
                        var entree2 = new RustlersRibs();
                        var screen2 = new CustomizeRustlersRibs();
                        screen2.DataContext = entree2;
                        order.Add(entree2);
                        orderControl.SwapScreen(screen2);
                        break;

                    case "PecosPulledPork":
                        var entree3 = new PecosPulledPork();
                        var screen3 = new CustomizePecosPulledPork();
                        screen3.DataContext = entree3;
                        order.Add(entree3);
                        orderControl.SwapScreen(screen3);
                        break;

                    case "TrailBurger":
                        var entree4 = new TrailBurger();
                        var screen4 = new CustomizeTrailBurger();
                        screen4.DataContext = entree4;
                        order.Add(entree4);
                        orderControl.SwapScreen(screen4);
                        break;

                    case "DakotaDoubleBurger":
                        var entree5 = new DakotaDoubleBurger();
                        var screen5 = new CustomizeDakotaDoubleBurger();
                        screen5.DataContext = entree5;
                        order.Add(entree5);
                        orderControl.SwapScreen(screen5);
                        break;

                    case "TexasTripleBurger":
                        var entree6 = new TexasTripleBurger();
                        var screen6 = new CustomizeTexasTripleBurger();
                        screen6.DataContext = entree6;
                        order.Add(entree6);
                        orderControl.SwapScreen(screen6);
                        break;

                    case "AngryChicken":
                        var entree7 = new AngryChicken();
                        var screen7 = new CustomizeAngryChicken();
                        screen7.DataContext = entree7;
                        order.Add(entree7);
                        orderControl.SwapScreen(screen7);
                        break;

                    case "ChiliCheeseFries":
                        var entree8 = new ChiliCheeseFries();
                        var screen8 = new CustomizeChiliCheeseFries();
                        screen8.DataContext = entree8;
                        order.Add(entree8);
                        orderControl.SwapScreen(screen8);
                        break;

                    case "CornDodgers":
                        var entree9 = new CornDodgers();
                        var screen9 = new CustomizeCornDodgers();
                        screen9.DataContext = entree9;
                        order.Add(entree9);
                        orderControl.SwapScreen(screen9);
                        break;

                    case "PanDeCampo":
                        var entree10 = new PanDeCampo();
                        var screen10 = new CustomizePanDeCampo();
                        screen10.DataContext = entree10;
                        order.Add(entree10);
                        orderControl.SwapScreen(screen10);
                        break;

                    case "BakedBeans":
                        var entree11 = new BakedBeans();
                        var screen11 = new CustomizeBakedBeans();
                        screen11.DataContext = entree11;
                        order.Add(entree11);
                        orderControl.SwapScreen(screen11);
                        break;

                    case "JerkedSoda":
                        var entree12 = new JerkedSoda();
                        var screen12 = new CustomizeJerkedSoda();
                        screen12.DataContext = entree12;
                        order.Add(entree12);
                        orderControl.SwapScreen(screen12);
                        break;

                    case "TexasTea":
                        var entree13 = new TexasTea();
                        var screen13 = new CustomizeTexasTea();
                        screen13.DataContext = entree13;
                        order.Add(entree13);
                        orderControl.SwapScreen(screen13);
                        break;

                    case "CowboyCoffee":
                        var entree14 = new CowboyCoffee();
                        var screen14 = new CustomizeCowboyCoffee();
                        screen14.DataContext = entree14;
                        order.Add(entree14);
                        orderControl.SwapScreen(screen14);
                        break;

                    case "Water":
                        var entree15 = new Water();
                        var screen15 = new CustomizeWater();
                        screen15.DataContext = entree15;
                        order.Add(entree15);
                        orderControl.SwapScreen(screen15);
                        break;
                    }
                }
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Allows the user to return to the special instructions screen for a selected item in the order
        /// </summary>
        /// <param name="sender">The item selected</param>
        /// <param name="e">The items in the listbox</param>
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            foreach (object item in e.AddedItems)
            {
                if (item is AngryChicken)
                {
                    var screen = new CustomizeAngryChicken();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is CowpokeChili)
                {
                    var screen = new CustomizeCowpokeChili();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is DakotaDoubleBurger)
                {
                    var screen = new CustomizeDakotaDoubleBurger();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is PecosPulledPork)
                {
                    var screen = new CustomizePecosPulledPork();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is TexasTripleBurger)
                {
                    var screen = new CustomizeTexasTripleBurger();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is TrailBurger)
                {
                    var screen = new CustomizeTrailBurger();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is BakedBeans)
                {
                    var screen = new CustomizeBakedBeans();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is ChiliCheeseFries)
                {
                    var screen = new CustomizeChiliCheeseFries();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is CornDodgers)
                {
                    var screen = new CustomizeCornDodgers();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is PanDeCampo)
                {
                    var screen = new CustomizePanDeCampo();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is CowboyCoffee)
                {
                    var screen = new CustomizeCowboyCoffee();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is JerkedSoda)
                {
                    var screen = new CustomizeJerkedSoda();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is TexasTea)
                {
                    var screen = new CustomizeTexasTea();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
                else if (item is Water)
                {
                    var screen = new CustomizeWater();
                    screen.DataContext = item;
                    orderControl.SwapScreen(screen);
                }
            }
        }
        void ItemSelected(object sender, SelectionChangedEventArgs e)
        {
            IOrderItem       item   = ItemsList.SelectedItem as IOrderItem;
            FrameworkElement screen = null;

            switch (item.ToString())
            {
            case "Small Cowboy Coffee":
                var orderControl = this.FindAncestor <OrderControl>();
                if (orderControl == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeCowboyCoffee(this.DataContext);
                screen.DataContext = item;
                orderControl.SwapScreen(screen);
                break;

            case "Medium Cowboy Coffee":
                var orderControl2 = this.FindAncestor <OrderControl>();
                if (orderControl2 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeCowboyCoffee(this.DataContext);
                screen.DataContext = item;
                orderControl2.SwapScreen(screen);
                break;

            case "Large Cowboy Coffee":
                var orderControl3 = this.FindAncestor <OrderControl>();
                if (orderControl3 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeCowboyCoffee(this.DataContext);
                screen.DataContext = item;
                orderControl3.SwapScreen(screen);
                break;

            case "Small Decaf Cowboy Coffee":
                var orderControl4 = this.FindAncestor <OrderControl>();
                if (orderControl4 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeCowboyCoffee(this.DataContext);
                screen.DataContext = item;
                orderControl4.SwapScreen(screen);
                break;

            case "Medium Decaf Cowboy Coffee":
                var orderControl5 = this.FindAncestor <OrderControl>();
                if (orderControl5 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeCowboyCoffee(this.DataContext);
                screen.DataContext = item;
                orderControl5.SwapScreen(screen);
                break;

            case "Large Decaf Cowboy Coffee":
                var orderControl6 = this.FindAncestor <OrderControl>();
                if (orderControl6 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeCowboyCoffee(this.DataContext);
                screen.DataContext = item;
                orderControl6.SwapScreen(screen);
                break;

            case "Small Cream Soda Jerked Soda":
                var orderControl7 = this.FindAncestor <OrderControl>();
                if (orderControl7 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl7.SwapScreen(screen);
                break;

            case "Medium Cream Soda Jerked Soda":
                var orderControl8 = this.FindAncestor <OrderControl>();
                if (orderControl8 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl8.SwapScreen(screen);
                break;

            case "Large Cream Soda Jerked Soda":
                var orderControl9 = this.FindAncestor <OrderControl>();
                if (orderControl9 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl9.SwapScreen(screen);
                break;

            case "Small Orange Soda Jerked Soda":
                var orderControl10 = this.FindAncestor <OrderControl>();
                if (orderControl10 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl10.SwapScreen(screen);
                break;

            case "Medium Orange Soda Jerked Soda":
                var orderControl11 = this.FindAncestor <OrderControl>();
                if (orderControl11 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl11.SwapScreen(screen);
                break;

            case "Large Orange Soda Jerked Soda":
                var orderControl12 = this.FindAncestor <OrderControl>();
                if (orderControl12 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl12.SwapScreen(screen);
                break;

            case "Small Sarsparilla Jerked Soda":
                var orderControl13 = this.FindAncestor <OrderControl>();
                if (orderControl13 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl13.SwapScreen(screen);
                break;

            case "Medium Sarsparilla Jerked Soda":
                var orderControl14 = this.FindAncestor <OrderControl>();
                if (orderControl14 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl14.SwapScreen(screen);
                break;

            case "Large Sarsparilla Jerked Soda":
                var orderControl15 = this.FindAncestor <OrderControl>();
                if (orderControl15 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl15.SwapScreen(screen);
                break;

            case "Small Root Beer Jerked Soda":
                var orderControl16 = this.FindAncestor <OrderControl>();
                if (orderControl16 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl16.SwapScreen(screen);
                break;

            case "Medium Root Beer Jerked Soda":
                var orderControl17 = this.FindAncestor <OrderControl>();
                if (orderControl17 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl17.SwapScreen(screen);
                break;

            case "Large Root Beer Jerked Soda":
                var orderControl18 = this.FindAncestor <OrderControl>();
                if (orderControl18 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl18.SwapScreen(screen);
                break;

            case "Small Birch Beer Jerked Soda":
                var orderControl19 = this.FindAncestor <OrderControl>();
                if (orderControl19 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl19.SwapScreen(screen);
                break;

            case "Medium Birch Beer Jerked Soda":
                var orderControl20 = this.FindAncestor <OrderControl>();
                if (orderControl20 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl20.SwapScreen(screen);
                break;

            case "Large Birch Beer Jerked Soda":
                var orderControl21 = this.FindAncestor <OrderControl>();
                if (orderControl21 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeJerkedSoda(this.DataContext);
                screen.DataContext = item;
                orderControl21.SwapScreen(screen);
                break;

            case "Small Texas Tea":
                var orderControl22 = this.FindAncestor <OrderControl>();
                if (orderControl22 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeTexasTea(this.DataContext);
                screen.DataContext = item;
                orderControl22.SwapScreen(screen);
                break;

            case "Medium Texas Tea":
                var orderControl23 = this.FindAncestor <OrderControl>();
                if (orderControl23 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeTexasTea(this.DataContext);
                screen.DataContext = item;
                orderControl23.SwapScreen(screen);
                break;

            case "Large Texas Tea":
                var orderControl24 = this.FindAncestor <OrderControl>();
                if (orderControl24 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeTexasTea(this.DataContext);
                screen.DataContext = item;
                orderControl24.SwapScreen(screen);
                break;

            case "Small Water":
                var orderControl25 = this.FindAncestor <OrderControl>();
                if (orderControl25 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeWater(this.DataContext);
                screen.DataContext = item;
                orderControl25.SwapScreen(screen);
                break;

            case "Medium Water":
                var orderControl26 = this.FindAncestor <OrderControl>();
                if (orderControl26 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeWater(this.DataContext);
                screen.DataContext = item;
                orderControl26.SwapScreen(screen);
                break;

            case "Large Water":
                var orderControl27 = this.FindAncestor <OrderControl>();
                if (orderControl27 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeWater(this.DataContext);
                screen.DataContext = item;
                orderControl27.SwapScreen(screen);
                break;

            case "Angry Chicken":
                var orderControl28 = this.FindAncestor <OrderControl>();
                if (orderControl28 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeAngryChicken(this.DataContext);
                screen.DataContext = item;
                orderControl28.SwapScreen(screen);
                break;

            case "Cowpoke Chili":
                var orderControl29 = this.FindAncestor <OrderControl>();
                if (orderControl29 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeCowpokeChili(this.DataContext);
                screen.DataContext = item;
                orderControl29.SwapScreen(screen);
                break;

            case "Dakota Double Burger":
                var orderControl30 = this.FindAncestor <OrderControl>();
                if (orderControl30 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeDakotaDoubleBurger(this.DataContext);
                screen.DataContext = item;
                orderControl30.SwapScreen(screen);
                break;

            case "Pecos Pulled Pork":
                var orderControl31 = this.FindAncestor <OrderControl>();
                if (orderControl31 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizePecosPulledPork(this.DataContext);
                screen.DataContext = item;
                orderControl31.SwapScreen(screen);
                break;

            case "Texas Triple Burger":
                var orderControl32 = this.FindAncestor <OrderControl>();
                if (orderControl32 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeTexasTripleBurger(this.DataContext);
                screen.DataContext = item;
                orderControl32.SwapScreen(screen); break;

            case "Trail Burger":
                var orderControl33 = this.FindAncestor <OrderControl>();
                if (orderControl33 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeTrailBurger(this.DataContext);
                screen.DataContext = item;
                orderControl33.SwapScreen(screen); break;

            case "Small Baked Beans":
                var orderControl34 = this.FindAncestor <OrderControl>();
                if (orderControl34 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeBakedBeans(this.DataContext);
                screen.DataContext = item;
                orderControl34.SwapScreen(screen);
                break;

            case "Medium Baked Beans":
                var orderControl35 = this.FindAncestor <OrderControl>();
                if (orderControl35 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeBakedBeans(this.DataContext);
                screen.DataContext = item;
                orderControl35.SwapScreen(screen);
                break;

            case "Large Baked Beans":
                var orderControl36 = this.FindAncestor <OrderControl>();
                if (orderControl36 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeBakedBeans(this.DataContext);
                screen.DataContext = item;
                orderControl36.SwapScreen(screen);
                break;

            case "Small Chili Cheese Fries":
                var orderControl37 = this.FindAncestor <OrderControl>();
                if (orderControl37 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeChiliCheeseFries(this.DataContext);
                screen.DataContext = item;
                orderControl37.SwapScreen(screen);
                break;

            case "Medium Chili Cheese Fries":
                var orderControl38 = this.FindAncestor <OrderControl>();
                if (orderControl38 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeChiliCheeseFries(this.DataContext);
                screen.DataContext = item;
                orderControl38.SwapScreen(screen);
                break;

            case "Large Chili Cheese Fries":
                var orderControl39 = this.FindAncestor <OrderControl>();
                if (orderControl39 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeChiliCheeseFries(this.DataContext);
                screen.DataContext = item;
                orderControl39.SwapScreen(screen);
                break;

            case "Small Corn Dodgers":
                var orderControl40 = this.FindAncestor <OrderControl>();
                if (orderControl40 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeCornDodgers(this.DataContext);
                screen.DataContext = item;
                orderControl40.SwapScreen(screen);
                break;

            case "Medium Corn Dodgers":
                var orderControl41 = this.FindAncestor <OrderControl>();
                if (orderControl41 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeCornDodgers(this.DataContext);
                screen.DataContext = item;
                orderControl41.SwapScreen(screen);
                break;

            case "Large Corn Dodgers":
                var orderControl42 = this.FindAncestor <OrderControl>();
                if (orderControl42 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizeCornDodgers(this.DataContext);
                screen.DataContext = item;
                orderControl42.SwapScreen(screen);
                break;

            case "Small Pan de Campo":
                var orderControl43 = this.FindAncestor <OrderControl>();
                if (orderControl43 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizePanDeCampo(this.DataContext);
                screen.DataContext = item;
                orderControl43.SwapScreen(screen);
                break;

            case "Medium Pan de Campo":
                var orderControl44 = this.FindAncestor <OrderControl>();
                if (orderControl44 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizePanDeCampo(this.DataContext);
                screen.DataContext = item;
                orderControl44.SwapScreen(screen);
                break;

            case "Large Pan de Campo":
                var orderControl45 = this.FindAncestor <OrderControl>();
                if (orderControl45 == null)
                {
                    throw new Exception("An ancestor of OrderControl expected");
                }
                screen             = new CustomizePanDeCampo(this.DataContext);
                screen.DataContext = item;
                orderControl45.SwapScreen(screen);
                break;

            case "Rustler's Ribs":
                break;

            default:
                throw new NotImplementedException("Unknown Item Selected");
            }
            //OpenCustomizationMenu(item, screen);
        }
        /// <summary>
        /// handles the buttons
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void itemAddTest(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 cow     = new CowpokeChili();
                        var cowCust = new CustomizeCowpokeChili();
                        cowCust.DataContext = cow;
                        order.Add(cow);
                        orderControl.SwapScreen(cowCust);
                        break;

                    case "AngryChicken":
                        var chicken     = new AngryChicken();
                        var chickenCust = new CustomizeAngryChicken();
                        chickenCust.DataContext = chicken;
                        order.Add(chicken);
                        orderControl.SwapScreen(chickenCust);
                        break;

                    case "TrailBurger":
                        var trailBurger     = new TrailBurger();
                        var trailBurgerCust = new CustomizeTrailburger();
                        trailBurgerCust.DataContext = trailBurger;
                        order.Add(trailBurger);
                        orderControl.SwapScreen(trailBurgerCust);
                        break;

                    //RustlersRibs does not take a customization
                    case "RustlersRibs":
                        order.Add(new RustlersRibs());
                        break;

                    case "PecosPulledPork":
                        var pecosPulledPork     = new PecosPulledPork();
                        var pecosPulledPorkCust = new CustomizePecosPulledPork();
                        pecosPulledPorkCust.DataContext = pecosPulledPork;
                        order.Add(pecosPulledPork);
                        orderControl.SwapScreen(pecosPulledPorkCust);
                        break;

                    case "DakotaDoubleBurger":
                        var dakotaDoubleBurger     = new DakotaDoubleBurger();
                        var dakotaDoubleBurgerCust = new CustomizeDakotaDoubleBurger();
                        dakotaDoubleBurgerCust.DataContext = dakotaDoubleBurger;
                        order.Add(dakotaDoubleBurger);
                        orderControl.SwapScreen(dakotaDoubleBurgerCust);
                        break;

                    case "TexasTripleBurger":
                        var texasTripleBurger     = new TexasTripleBurger();
                        var texasTripleBurgerCust = new CustomizeTexasTripleBurger();
                        texasTripleBurgerCust.DataContext = texasTripleBurger;
                        order.Add(texasTripleBurger);
                        orderControl.SwapScreen(texasTripleBurgerCust);
                        break;

                    //sides:
                    case "ChiliCheeseFries":
                        var chiliCheeseFries     = new ChiliCheeseFries();
                        var chiliCheeseFriesCust = new CustomizeChiliCheeseFries();
                        chiliCheeseFriesCust.DataContext = chiliCheeseFries;
                        order.Add(chiliCheeseFries);
                        orderControl.SwapScreen(chiliCheeseFriesCust);
                        break;

                    case "CornDodgers":
                        var cornDodgers     = new CornDodgers();
                        var cornDodgersCust = new CustomizeCornDodgers();
                        cornDodgersCust.DataContext = cornDodgers;
                        order.Add(cornDodgers);
                        orderControl.SwapScreen(cornDodgersCust);
                        break;

                    case "PanDeCampo":
                        var panDeCampo     = new PanDeCampo();
                        var panDeCampoCust = new CustomizePanDeCampo();
                        panDeCampoCust.DataContext = panDeCampo;
                        order.Add(panDeCampo);
                        orderControl.SwapScreen(panDeCampoCust);
                        break;

                    case "BakedBeans":
                        var bakedBeans     = new BakedBeans();
                        var bakedBeansCust = new CustomizeBakedBeans();
                        bakedBeansCust.DataContext = bakedBeans;
                        order.Add(bakedBeans);
                        orderControl.SwapScreen(bakedBeansCust);
                        break;

                    //drinks:
                    case "JerkedSoda":
                        var jerkedSoda     = new JerkedSoda();
                        var jerkedSodaCust = new CustomizeJerkedSoda();
                        jerkedSodaCust.DataContext = jerkedSoda;
                        order.Add(jerkedSoda);
                        orderControl.SwapScreen(jerkedSodaCust);
                        break;

                    case "TexasTea":
                        var texasTea     = new TexasTea();
                        var texasTeaCust = new CustomizeTexasTea();
                        texasTeaCust.DataContext = texasTea;
                        order.Add(texasTea);
                        orderControl.SwapScreen(texasTeaCust);
                        break;

                    case "CowboyCoffee":
                        var cowboyCoffee     = new CowboyCoffee();
                        var cowboyCoffeeCust = new CustomizeCowboyCoffee();
                        cowboyCoffeeCust.DataContext = cowboyCoffee;
                        order.Add(cowboyCoffee);
                        orderControl.SwapScreen(cowboyCoffeeCust);
                        break;

                    case "Water":
                        var water     = new Water();
                        var waterCust = new CustomizeWater();
                        waterCust.DataContext = water;
                        order.Add(water);
                        orderControl.SwapScreen(waterCust);
                        break;
                    }
                }
            }
        }
Esempio n. 25
0
        /// <summary>
        /// When an item from the order summary is selected, the screen switches to the corresponding customization screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnSelectItem(object sender, RoutedEventArgs e)
        {
            if (DataContext is Order order)
            {
                if (sender is ListBox lb)
                {
                    if (lb.SelectedItem != null)
                    {
                        var item = lb.SelectedItem;
                        FrameworkElement screen;
                        switch (item.ToString())
                        {
                        case "Trail Burger":
                            screen = new CustomizeTrailBurger();
                            break;

                        case "Dakota Double Burger":
                            screen = new CustomizeDakotaDoubleBurger();
                            break;

                        case "Texas Triple Burger":
                            screen = new CustomizeTexasTripleBurger();
                            break;

                        case "Angry Chicken":
                            screen = new CustomizeAngryChicken();
                            break;

                        case "Cowpoke Chili":
                            screen = new CustomizeCowpokeChili();
                            break;

                        case "Pecos Pulled Pork":
                            screen = new CustomizePecosPulledPork();
                            break;

                        default:
                            screen = null;
                            break;
                        }

                        if (item is Side)
                        {
                            screen = new CustomizeSide();
                        }
                        if (item is CowboyCoffee)
                        {
                            screen = new CustomizeCowboyCoffee();
                        }
                        if (item is JerkedSoda)
                        {
                            screen = new CustomizeJerkedSoda();
                        }
                        if (item is TexasTea)
                        {
                            screen = new CustomizeTexasTea();
                        }
                        if (item is Water)
                        {
                            screen = new CustomizeWater();
                        }

                        if (screen != null)
                        {
                            var orderControl = this.FindAncestor <OrderControl>();
                            if (orderControl == null)
                            {
                                throw new Exception("An ancestor of Ordercontrol expected to not be null");
                            }

                            screen.DataContext = item;
                            orderControl.SwapScreen(screen);
                        }
                        lb.SelectedIndex = -1;
                    }
                }
            }
        }
        /// <summary>
        /// Determines which menu item to add to order while also sending the user
        /// to the selection controls for each menu item
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    case "AngryChicken":
                        var entree = new AngryChicken();
                        var screen = new CustomizeAngryChicken();
                        AddItemAndOpenCustimizationScreen(entree, screen);
                        break;

                    case "CowpokeChili":
                        var entree2 = new CowpokeChili();
                        var screen2 = new CustomizeCowpokeChili();
                        AddItemAndOpenCustimizationScreen(entree2, screen2);
                        break;

                    case "RustlersRibs":
                        var entree3 = new RustlersRibs();
                        var screen3 = new CustomizeRustlersRibs();
                        AddItemAndOpenCustimizationScreen(entree3, screen3);
                        break;

                    case "PecosPulledPork":
                        var entree4 = new PecosPulledPork();
                        var screen4 = new CustomizePecosPulledPork();
                        AddItemAndOpenCustimizationScreen(entree4, screen4);
                        break;

                    case "TrailBurger":
                        var entree5 = new TrailBurger();
                        var screen5 = new CustomizeTrailBurger();
                        AddItemAndOpenCustimizationScreen(entree5, screen5);
                        break;

                    case "DakotaDoubleBurger":
                        var entree6 = new DakotaDoubleBurger();
                        var screen6 = new CustomizeDakotaDoubleBurger();
                        AddItemAndOpenCustimizationScreen(entree6, screen6);
                        break;

                    case "TexasTripleBurger":
                        var entree7 = new TexasTripleBurger();
                        var screen7 = new CustomizeTexasTripleBurger();
                        AddItemAndOpenCustimizationScreen(entree7, screen7);
                        break;

                    case "ChiliCheeseFries":
                        var entree8 = new ChiliCheeseFries();
                        var screen8 = new CustomizeChiliCheeseFries();
                        AddItemAndOpenCustimizationScreen(entree8, screen8);
                        break;

                    case "CornDodgers":
                        var entree9 = new CornDodgers();
                        var screen9 = new CustomizeCornDodgers();
                        AddItemAndOpenCustimizationScreen(entree9, screen9);
                        break;

                    case "PanDeCampo":
                        var entree10 = new PanDeCampo();
                        var screen10 = new CustomizePanDeCampo();
                        AddItemAndOpenCustimizationScreen(entree10, screen10);
                        break;

                    case "BakedBeans":
                        var entree11 = new BakedBeans();
                        var screen11 = new CustomizeBakedBeans();
                        AddItemAndOpenCustimizationScreen(entree11, screen11);
                        break;

                    case "CowboyCoffee":
                        var entree12 = new CowboyCoffee();
                        var screen12 = new CustomizeCowboyCoffee();
                        AddItemAndOpenCustimizationScreen(entree12, screen12);
                        break;

                    case "JerkedSoda":
                        var entree13 = new JerkedSoda();
                        var screen13 = new CustomizeJerkedSoda();
                        AddItemAndOpenCustimizationScreen(entree13, screen13);
                        break;

                    case "TexasTea":
                        var entree14 = new TexasTea();
                        var screen14 = new CustomizeTexasTea();
                        AddItemAndOpenCustimizationScreen(entree14, screen14);
                        break;

                    case "Water":
                        var entree15 = new Water();
                        var screen15 = new CustomizeWater();
                        AddItemAndOpenCustimizationScreen(entree15, screen15);
                        break;
                    }
                }
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Swaps screen to the item clicked in the order summary control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OrderSummaryItemSelected(object sender, SelectionChangedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (orderControl == null)
            {
                return;
            }

            foreach (object i in e.AddedItems)
            {
                if (i is CowpokeChili)
                {
                    CustomizeCowpokeChili screen = new CustomizeCowpokeChili();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is RustlersRibs)
                {
                    CustomizeRustlersRibs screen = new CustomizeRustlersRibs();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is PecosPulledPork)
                {
                    CustomizePecosPulledPork screen = new CustomizePecosPulledPork();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is TrailBurger)
                {
                    CustomizeTrailBurger screen = new CustomizeTrailBurger();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is DakotaDoubleBurger)
                {
                    CustomizeDakotaDoubleBurger screen = new CustomizeDakotaDoubleBurger();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is TexasTripleBurger)
                {
                    CustomizeTexasTripleBurger screen = new CustomizeTexasTripleBurger();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is AngryChicken)
                {
                    CustomizeAngryChicken screen = new CustomizeAngryChicken();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is ChiliCheeseFries)
                {
                    CustomizeChiliCheeseFries screen = new CustomizeChiliCheeseFries();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is CornDodgers)
                {
                    CustomizeCornDodgers screen = new CustomizeCornDodgers();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is PanDeCampo)
                {
                    CustomizePanDeCampo screen = new CustomizePanDeCampo();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is BakedBeans)
                {
                    CustomizeBakedBeans screen = new CustomizeBakedBeans();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is JerkedSoda)
                {
                    CustomizeJerkedSoda screen = new CustomizeJerkedSoda();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is TexasTea)
                {
                    CustomizeTexasTea screen = new CustomizeTexasTea();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is CowboyCoffee)
                {
                    CustomizeCowboyCoffee screen = new CustomizeCowboyCoffee();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
                else if (i is Water)
                {
                    CustomizeWater screen = new CustomizeWater();
                    screen.DataContext = i;
                    orderControl.SwapScreen(screen);
                }
            }
        }