예제 #1
0
        /// <summary>
        /// Listener for the click event of the Cowboy Coffee Button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnAddCowboyCoffeeButton_Clicked(object sender, RoutedEventArgs e)
        {
            CowboyCoffee c      = new CowboyCoffee();
            var          screen = new CustomizeCowboyCoffee();

            AddItemAndOpenCustomizationScreen(c, screen);
        }
예제 #2
0
 /// <summary>
 /// Click event handler for Cowboy Coffee Button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnAddCowboyCoffeeButtonClicked(object sender, RoutedEventArgs e)
 {
     if (DataContext is Order data)
     {
         var item   = new CowboyCoffee();
         var screen = new CustomizeCowboyCoffee();
         AddItemAndOpenCustomization(item, screen);
     }
 }
예제 #3
0
        /// <summary>
        /// Click event handler for Cowboy Coffee Button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnAddCowboyCoffeeButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order data)
            {
                var item   = new CowboyCoffee();
                var screen = new CustomizeCowboyCoffee();
                AddItemAndOpenCustomization(item, screen);
            }
        }
 /// <summary>
 /// adds cowboy coffee to ordersummary control and order column on mainwindow
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnAddCowboyCoffeeButtonClicked(object sender, RoutedEventArgs e)
 {
     if (DataContext is Order data) // checks if you can cast it and if assigns it to data
     {
         var item   = new CowboyCoffee();
         var screen = new CustomizeCowboyCoffee();
         screen.DataContext = item;
         data.Add(item);
         AddItemandOpenCustomizationScreen(item, screen);
     }
 }
        /// <summary>
        /// Adds Item to the order
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnAddCowboyCoffeeButtonClicked(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 CowboyCoffee();
                var screen = new CustomizeCowboyCoffee();
                AddItemAndOpenCustomizationScreen(entree, screen);
            }
        }
예제 #6
0
        /// <summary>
        /// Adds Cowboy Coffee to order list when corresponding button is pushed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnCowboyCoffeeAdded(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order data)
            {
                var drink  = new CowboyCoffee();
                var screen = new CustomizeCowboyCoffee();
                AddItemAndOpenCustomizationScreen(drink, screen);
            }
        }
 /// <summary>
 /// Event handler for adding the cowboy coffee drink to the order
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnAddCowboyCoffeeButtonClicked(object sender, RoutedEventArgs e)
 {
     if (DataContext is Order data)
     {
         var newCowboyCoffee = new CowboyCoffee();
         var screen          = new CustomizeCowboyCoffee();
         screen.DataContext = newCowboyCoffee;
         data.Add(newCowboyCoffee);
         orderControl = this.FindAncestor <OrderControl>();
         orderControl.SwapScreen(screen);
     }
 }
        /// <summary>
        /// Adds Cowboy Coffee to the display when clicked
        /// </summary>
        /// <param name="sender">When the button is clicked</param>
        /// <param name="e">The data that is gathered when clicked</param>
        void OnAddCowboyCoffeeButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                var side   = new CowboyCoffee();
                var screen = new CustomizeCowboyCoffee(DataContext);
                screen.DataContext = side;
                order.Add(side);
                orderControl?.SwapScreen(screen);
            }
        }
예제 #9
0
        /// <summary>
        /// the event handler for the cowboy coffee
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AddToOrderCowboyCoffee(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order data)
            {
                var entree = new CowboyCoffee();
                var screen = new CustomizeCowboyCoffee();
                screen.DataContext = entree;
                data.Add(new CowboyCoffee());
                orderControl.SwapScreen(new CustomizeCowboyCoffee());
            }
        }
예제 #10
0
 void OnAddCowboyCoffeeButtonClicked(object sender, RoutedEventArgs e)
 {
     //o.Add(new CowboyCoffee());
     orderControl = this.FindAncestor <OrderControl>();
     if (DataContext is Order order)
     {
         var drink  = new CowboyCoffee();
         var screen = new CustomizeCowboyCoffee();
         screen.DataContext = drink;
         order.Add(drink);
         orderControl.SwapScreen(screen);
     }
 }
        /// <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;
                    }
                }
            }
        }
        /// <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>
        /// 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);
                    }
                }
            }
        }
 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>
        /// Selection Changed event for The Items List view
        /// </summary>
        /// <param name="sender">item clicked</param>
        /// <param name="e">event args</param>
        void OnSelectedItem(object sender, SelectionChangedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();
            var lvi          = ((sender as ListView).SelectedItem as IOrderItem);

            if (this.DataContext is Order order)
            {
                var foodItem = (lvi);
                ;
                if (lvi is CowpokeChili)
                {
                    var screen = new CustomizeCowpokeChili();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is AngryChicken)
                {
                    var screen = new CustomizeAngryChicken();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is BakedBeans)
                {
                    var screen = new CustomizeBakedBeans();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is ChiliCheeseFries)
                {
                    var screen = new CustomizeChiliCheeseFries();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is CornDodgers)
                {
                    var screen = new CustomizeCornDodgers();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is CowboyCoffee)
                {
                    var screen = new CustomizeCowboyCoffee();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is DakotaDoubleBurger)
                {
                    var screen = new CustomizeDakotaDouble();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is JerkedSoda)
                {
                    var screen = new CustomizeJerkedSoda();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is PanDeCampo)
                {
                    var screen = new CustomizePanDeCampo();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is PecosPulledPork)
                {
                    var screen = new CustomizePecosPulledPork();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is TexasTea)
                {
                    var screen = new CustomizeTexasTea();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is TexasTripleBurger)
                {
                    var screen = new CustomizeTexasTriple();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is Water)
                {
                    var screen = new CustomizeWater();
                    screen.DataContext = foodItem;
                    orderControl.SwapScreen(screen);
                }
                else if (lvi is TrailBurger)
                {
                    var screen = new CustomizeTrailBurger();
                    screen.DataContext = foodItem;
                    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;
                    }
                }
            }
        }
        /// <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();
            }
        }
예제 #18
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);
                }
            }
        }
예제 #19
0
 public void SwitchScreen(object sender, RoutedEventArgs e)
 {
     if (sender is ListBox box)
     {
         if (box.SelectedItem is IOrderItem item)
         {
             box.SelectedItem = null;
             if (item is AngryChicken chicken)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeAngryChicken();
                 screen.DataContext = chicken;
                 order.SwapScreen(screen);
             }
             else if (item is BakedBeans bean)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeSide();
                 screen.DataContext = bean;
                 order.SwapScreen(screen);
             }
             else if (item is ChiliCheeseFries fries)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeSide();
                 screen.DataContext = fries;
                 order.SwapScreen(screen);
             }
             else if (item is CornDodgers corn)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeSide();
                 screen.DataContext = corn;
                 order.SwapScreen(screen);
             }
             else if (item is CowboyCoffee coffee)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeCowboyCoffee();
                 screen.DataContext = coffee;
                 order.SwapScreen(screen);
             }
             else if (item is CowpokeChili chili)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeCowpokeChili();
                 screen.DataContext = chili;
                 order.SwapScreen(screen);
             }
             else if (item is DakotaDoubleBurger dakota)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeDakotaDouble();
                 screen.DataContext = dakota;
                 order.SwapScreen(screen);
             }
             else if (item is JerkedSoda soda)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeJerkedSoda();
                 screen.DataContext = soda;
                 order.SwapScreen(screen);
             }
             else if (item is PanDeCampo pan)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeSide();
                 screen.DataContext = pan;
                 order.SwapScreen(screen);
             }
             else if (item is PecosPulledPork pork)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizePecosPulledPork();
                 screen.DataContext = pork;
                 order.SwapScreen(screen);
             }
             else if (item is TexasTea tea)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeTexasTea();
                 screen.DataContext = tea;
                 order.SwapScreen(screen);
             }
             else if (item is TexasTripleBurger tex)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeTexasTriple();
                 screen.DataContext = tex;
                 order.SwapScreen(screen);
             }
             else if (item is TrailBurger burger)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeTrailburger();
                 screen.DataContext = burger;
                 order.SwapScreen(screen);
             }
             else if (item is Water water)
             {
                 order = this.FindAncestor <OrderControl>();
                 var screen = new CustomizeWater();
                 screen.DataContext = water;
                 order.SwapScreen(screen);
             }
         }
     }
 }
예제 #20
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;
                    }
                }
            }
        }
        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>
        /// 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>
        /// Depending on the item the user clicks. This action handler adds the item to list, and displays the swapped screen with the menuitem screen so the user can customize.
        /// </summary>
        /// <param name="sender">??</param>
        /// <param name="e">??</param>
        void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {                                                                                           //Example of Button clicked in one method instead of so many event handlers
                    switch (button.Tag)
                    {
                    case "CowpokeChili":
                        var itemCPC   = new CowpokeChili();
                        var screenCPC = new CustomizeCowpokeChili();
                        AddItemAndOpenCustomizationScreen(itemCPC, screenCPC);
                        break;

                    case "TrailBurger":
                        var itemTB   = new TrailBurger();
                        var screenTB = new CustomizeTrailBurger();
                        AddItemAndOpenCustomizationScreen(itemTB, screenTB);
                        break;

                    case "AngryChicken":
                        var itemAC   = new AngryChicken();
                        var screenAC = new CustomizeAngryChicken();
                        AddItemAndOpenCustomizationScreen(itemAC, screenAC);
                        break;

                    case "DakotaDouble":
                        var itemDD   = new DakotaDoubleBurger();
                        var screenDD = new CustomizeDakotaDouble();
                        AddItemAndOpenCustomizationScreen(itemDD, screenDD);
                        break;

                    case "TexasTriple":
                        var itemTT   = new TexasTripleBurger();
                        var screenTT = new CustomizeTexasTriple();
                        AddItemAndOpenCustomizationScreen(itemTT, screenTT);
                        break;

                    case "PecosPork":
                        var itemPP   = new PecosPulledPork();
                        var screenPP = new CustomizePecosPulledPork();
                        AddItemAndOpenCustomizationScreen(itemPP, screenPP);
                        break;

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

                    case "BakedBeans":
                        var itemBB   = new BakedBeans();
                        var screenBB = new CustomizeBakedBeans();
                        AddItemAndOpenCustomizationScreen(itemBB, screenBB);
                        break;

                    case "ChiliCheeseFries":
                        var itemCCF   = new ChiliCheeseFries();
                        var screenCCF = new CustomizeChiliCheeseFries();
                        AddItemAndOpenCustomizationScreen(itemCCF, screenCCF);
                        break;

                    case "CornDodgers":
                        var itemCD   = new CornDodgers();
                        var screenCD = new CustomizeCornDodgers();
                        AddItemAndOpenCustomizationScreen(itemCD, screenCD);
                        break;

                    case "PanDeCampo":
                        var itemPD   = new PanDeCampo();
                        var screenPD = new CustomizePanDeCampo();
                        AddItemAndOpenCustomizationScreen(itemPD, screenPD);
                        break;

                    case "JerkedSoda":
                        var itemJS   = new JerkedSoda();
                        var screenJS = new CustomizeJerkedSoda();
                        AddItemAndOpenCustomizationScreen(itemJS, screenJS);
                        break;

                    case "CowboyCoffee":
                        var itemCC   = new CowboyCoffee();
                        var screenCC = new CustomizeCowboyCoffee();
                        AddItemAndOpenCustomizationScreen(itemCC, screenCC);
                        break;

                    case "TexasTea":
                        var itemTXT   = new TexasTea();
                        var screenTXT = new CustomizeTexasTea();
                        AddItemAndOpenCustomizationScreen(itemTXT, screenTXT);
                        break;

                    case "Water":
                        var itemW   = new Water();
                        var screenW = new CustomizeWater();
                        AddItemAndOpenCustomizationScreen(itemW, screenW);
                        break;
                    }
                }
            }
        }
        /// <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;
                    }
                }
            }
        }
 /// <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;
             }
         }
     }
 }
예제 #26
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);
            }
        }
        /// <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;
                    }
                }
            }
        }
예제 #28
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);
                    }
                }
            }
        }
        public void OnItemButtonClicked(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 chiliEntree = new CowpokeChili();
                        var chiliScreen = new CustomizeCowpokeChili();
                        chiliScreen.DataContext = chiliEntree;
                        order.Add(chiliEntree);
                        orderControl.SwapScreen(chiliScreen);
                        break;

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

                    case "Trailburger":
                        var trailentree = new TrailBurger();
                        var trailscreen = new CustomizeTrailburger();
                        trailscreen.DataContext = trailentree;
                        order.Add(trailentree);
                        orderControl.SwapScreen(trailscreen);
                        break;

                    case "DakotaDouble":
                        var dakotaentree = new DakotaDoubleBurger();
                        var dakotascreen = new CustomizeDakotaDouble();
                        dakotascreen.DataContext = dakotaentree;
                        order.Add(dakotaentree);
                        orderControl.SwapScreen(dakotascreen);
                        break;

                    case "TexasTriple":
                        var texasentree = new TexasTripleBurger();
                        var texasscreen = new CustomizeTexasTriple();
                        texasscreen.DataContext = texasentree;
                        order.Add(texasentree);
                        orderControl.SwapScreen(texasscreen);
                        break;

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

                    case "ChiliCheeseFries":
                        var chilientree = new ChiliCheeseFries();
                        var chiliscreen = new CustomizeSide();
                        chiliscreen.DataContext = chilientree;
                        order.Add(chilientree);
                        orderControl.SwapScreen(chiliscreen);
                        break;

                    case "CornDodgers":
                        var dogerentree = new CornDodgers();
                        var dogerscreen = new CustomizeSide();
                        dogerscreen.DataContext = dogerentree;
                        order.Add(dogerentree);
                        orderControl.SwapScreen(dogerscreen);
                        break;

                    case "PanDeCampo":
                        var panentree = new PanDeCampo();
                        var panscreen = new CustomizeSide();
                        panscreen.DataContext = panentree;
                        order.Add(panentree);
                        orderControl.SwapScreen(panscreen);
                        break;

                    case "BakedBeans":
                        var Beansentree = new BakedBeans();
                        var Beansscreen = new CustomizeSide();
                        Beansscreen.DataContext = Beansentree;
                        order.Add(Beansentree);
                        orderControl.SwapScreen(Beansscreen);
                        break;

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

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

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

                    case "Water":
                        var waterentree = new Water();
                        var waterscreen = new CustomizeWater();
                        waterscreen.DataContext = waterentree;
                        order.Add(waterentree);
                        orderControl.SwapScreen(waterscreen);
                        break;
                    }
                }
            }
        }
        /// <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);
                        }
                    }
                }
            }
        }