//CLICK EVENT HANDLERS FOR DRINKS

        private void CustomizeDrink(Drink drink)
        {
            if (DataContext is Order myOrder)
            {
                var         orderControl = this.FindAncestor <OrderControl>();
                UserControl screen       = null;
                switch (drink)
                {
                case CowboyCoffee cc:
                    screen = new CowboyCoffeeCustomization();
                    break;

                case JerkedSoda js:
                    screen = new JerkedSodaCustomization();
                    break;

                case TexasTea tt:
                    screen = new TexasTeaCustomization();
                    break;

                case Water w:
                    screen = new WaterCustomization();
                    break;

                default:
                    break;
                }
                myOrder.Add(drink);
                if (screen != null)
                {
                    screen.DataContext = drink;
                    orderControl.SwapScreen(screen);
                }
            }
        }
示例#2
0
        /// <summary>
        /// This method adds drinks to the list by converting the
        /// sender object to a button and filtering on the name of the button
        /// that was pressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addDrinkToList(object sender, RoutedEventArgs e)
        {
            //Ensure the DataContext is an Order and not NULL
            if (DataContext is Order data)
            {
                //Ensure the sender is on of buttons
                if (sender is Button)
                {
                    IOrderItem       item;
                    FrameworkElement screen;
                    var orderControl = this.FindAncestor <OrderControl>();

                    //Filter which button was pressed based on name
                    switch (((Button)sender).Name)
                    {
                    //Cowboy Coffee
                    case "CowboyCoffeeButton":
                        item   = new CowboyCoffee();
                        screen = new CowboyCoffeeCustomization();
                        break;

                    //Jerked Soda
                    case "JerkedSodaButton":
                        item   = new JerkedSoda();
                        screen = new JerkedSodaCustomization();
                        break;

                    //Texas Tea
                    case "TexasTeaButton":
                        item   = new TexasTea();
                        screen = new TexasTeaCustomization();
                        break;

                    //Water
                    case "WaterButton":
                        item   = new Water();
                        screen = new WaterCustomization();
                        break;

                    //This should never be reached unless we add more sides and forget to add the case statements ;P
                    default:
                        throw new NotImplementedException("Unknown drink button clicked");
                    }
                    //Set the datacontext of the screen to the item and set the items screen property equal to the screen
                    screen.DataContext = item;
                    item.Screen        = screen;

                    //Add the item to the order and swap the screen
                    data.Add(item);
                    orderControl?.SwapScreen(screen);
                }
            }
        }
        /// <summary>
        /// Adds Water to the list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddWaterButton_Click(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();
            var screen       = new WaterCustomization();
            var item         = new Water();

            screen.DataContext = item;
            if (DataContext is Order order)
            {
                order.Add(item);
                orderControl?.SwapScreen(screen);
            }
        }
        /// <summary>
        /// adds water to the list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddWaterButton_Click(object sender, RoutedEventArgs e)
        {
            var   ordercontrol = this.FindAncestor <OrderControl>();
            Water tempWater    = new Water();

            if (DataContext is Order data)
            {
                data.Add(tempWater);
                var screen = new WaterCustomization();
                screen.DataContext = tempWater;
                ordercontrol.SwapScreen(screen);
            }
        }
示例#5
0
        /// <summary>
        /// All the functionality for the event handlers declared above is created in the code below.
        /// </summary>

        /// Drinks

        /// <summary>
        /// Add water button event handler
        /// </summary>
        private void AddWater_Click(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            Water temp = new Water();

            if (DataContext is Order order)
            {
                var screen = new WaterCustomization();
                screen.DataContext = temp;
                order.Add(temp);
                orderControl?.SwapScreen(screen);
            }
        }
        /// <summary>
        /// This method adds drinks to the list by converting the
        /// sender object to a button and filtering on the name of the button
        /// that was pressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addDrinkToList(object sender, RoutedEventArgs e)
        {
            //Ensure the DataContext is an Order and not NULL
            if (DataContext is Order data)
            {
                if (sender is Button)
                {
                    IOrderItem       item;
                    FrameworkElement screen = null;
                    var orderControl        = this.FindAncestor <OrderControl>();

                    //Cast sender to button
                    Button b = (Button)sender;

                    //Filter which button was pressed based on name
                    switch (b.Name)
                    {
                    case "CowboyCoffeeButton":
                        item   = new CowboyCoffee();
                        screen = new CowboyCoffeeCustomization(DataContext);
                        break;

                    case "JerkedSodaButton":
                        item   = new JerkedSoda();
                        screen = new JerkedSodaCustomization(DataContext);
                        break;

                    case "TexasTeaButton":
                        item   = new TexasTea();
                        screen = new TexasTeaCustomization(DataContext);
                        break;

                    case "WaterButton":
                        item   = new Water();
                        screen = new WaterCustomization(DataContext);
                        break;

                    default:
                        throw new NotImplementedException("Unknown drink button clicked");
                    }
                    if (screen != null)
                    {
                        screen.DataContext = item;
                    }
                    data.Add(item);
                    orderControl?.SwapScreen(screen);
                }
            }
        }
        /// <summary>
        /// Click event handler for the Water drink button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WaterButton_Click(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order data)
            {
                if (sender is Button button)
                {
                    var item   = new Water();
                    var screen = new WaterCustomization(DataContext);
                    screen.DataContext = item;
                    data.Add(item);
                    screen.ButtonSizeSwitch(item.Size);
                    orderControl?.SwapScreen(screen);
                }
            }
        }
        /// <summary>
        ///  Creates a new Water object and adds it to the Order List Checked List Box.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddWaterButton(object sender, EventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    case "Water":
                        var item   = new Water();
                        var screen = new WaterCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;
                    }
                }
            }
        }
        private void OrderList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (sender is ListBox lb)
            {
                if (lb.SelectedItem is IOrderItem item)
                {
                    if (item.ToString().Contains("Angry Chicken"))
                    {
                        var chickenScreen = new AngryChickenCustomization();
                        chickenScreen.DataContext = item;
                        orderControl?.SwapScreen(chickenScreen);
                    }
                    else if (item.ToString().Contains("Cowpoke Chili"))
                    {
                        var chiliScreen = new CowpokeChiliCustomization();
                        chiliScreen.DataContext = item;
                        orderControl?.SwapScreen(chiliScreen);
                    }
                    else if (item.ToString().Contains("Dakota Double Burger"))
                    {
                        var doubleScreen = new DakotaDoubleBurgerCustomization();
                        doubleScreen.DataContext = item;
                        orderControl?.SwapScreen(doubleScreen);
                    }
                    else if (item.ToString().Contains("Pecos Pulled Pork"))
                    {
                        var pecosScreen = new PecosPulledPorkCustomization();
                        pecosScreen.DataContext = item;
                        orderControl?.SwapScreen(pecosScreen);
                    }
                    else if (item.ToString().Contains("Rustler's Ribs"))
                    {
                        var ribsScreen = new RustlersRibsCustomization();
                        ribsScreen.DataContext = item;
                        orderControl?.SwapScreen(ribsScreen);
                    }
                    else if (item.ToString().Contains("Texas Triple Burger"))
                    {
                        var tripleScreen = new TexasTripleBurgerCustomization();
                        tripleScreen.DataContext = item;
                        orderControl?.SwapScreen(tripleScreen);
                    }
                    else if (item.ToString().Contains("Trail Burger"))
                    {
                        var burgerScreen = new TrailBurgerCustomization();
                        burgerScreen.DataContext = item;
                        orderControl?.SwapScreen(burgerScreen);
                    }
                    else if (item.ToString().Contains("Baked Beans"))
                    {
                        var beansScreen = new SideCustomization(item as Side);
                        orderControl?.SwapScreen(beansScreen);
                    }
                    else if (item.ToString().Contains("Chili Cheese Fries"))
                    {
                        var friesScreen = new SideCustomization(item as Side);
                        orderControl?.SwapScreen(friesScreen);
                    }
                    else if (item.ToString().Contains("Corn Dodgers"))
                    {
                        var cornScreen = new SideCustomization(item as Side);
                        orderControl?.SwapScreen(cornScreen);
                    }
                    else if (item.ToString().Contains("Pan de Campo"))
                    {
                        var panScreen = new SideCustomization(item as Side);
                        orderControl?.SwapScreen(panScreen);
                    }
                    else if (item.ToString().Contains("Cowboy Coffee"))
                    {
                        var coffeeScreen = new CowboyCoffeeCustomization(item as CowboyCoffee);
                        orderControl?.SwapScreen(coffeeScreen);
                    }
                    else if (item.ToString().Contains("Jerked Soda"))
                    {
                        var sodaScreen = new JerkedSodaCustomization(item as JerkedSoda);
                        orderControl?.SwapScreen(sodaScreen);
                    }
                    else if (item.ToString().Contains("Texas Tea"))
                    {
                        var teaScreen = new TexasTeaCustomization(item as TexasTea);
                        orderControl?.SwapScreen(teaScreen);
                    }
                    else if (item.ToString().Contains("Water"))
                    {
                        var waterScreen = new WaterCustomization(item as Water);
                        orderControl?.SwapScreen(waterScreen);
                    }
                }
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var    orderControl = this.FindAncestor <OrderControl>();
            Button b            = (Button)sender;

            if (DataContext is Order data)
            {
                switch (b.Name)
                {
                //Entrees
                case "AddAngryChickenButton":
                {
                    var item   = new AngryChicken();
                    var screen = new AngryChickenCustomization();
                    screen.DataContext = item;
                    data.Add(item);
                    orderControl?.SwapScreen(screen);
                    break;
                }

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

                case "AddRustlersRibsButton":
                    data.Add(new RustlersRibs());
                    break;

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

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

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

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

                //Sides
                case "AddBakedBeansButton":
                    data.Add(new BakedBeans());
                    break;

                case "AddChiliCheeseFriesButton":
                    data.Add(new ChiliCheeseFries());
                    break;

                case "AddCornDodgersButton":
                    data.Add(new CornDodgers());
                    break;

                case "AddPanDeCampoButton":
                    data.Add(new PanDeCampo());
                    break;

                //Drinks
                case "AddJerkedSodaButton":
                    data.Add(new JerkedSoda());
                    break;

                case "AddCowboyCoffeeButton":
                    data.Add(new CowboyCoffee());
                    break;

                case "AddTexasTeaButton":
                    data.Add(new TexasTea());
                    break;

                case "AddWaterButton":
                {
                    var item   = new Water();
                    var screen = new WaterCustomization();
                    screen.DataContext = item;
                    data.Add(item);
                    orderControl?.SwapScreen(screen);
                    break;
                }
                }
            }
        }
示例#11
0
 private void PList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (DataContext is Order order)
     {
         if (sender is ListBox box)
         {
             var ordercontrol = this.FindAncestor <OrderControl>();
             if (box.SelectedItem is IOrderItem i)
             {
                 if (i is AngryChicken)
                 {
                     var screen = new AngryChickenCustomization();
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is BakedBeans)
                 {
                     var screen = new BakedBeansCustomization(order);
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is ChiliCheeseFries)
                 {
                     var screen = new ChiliCheeseFriesCustomization(order);
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is CornDodgers)
                 {
                     var screen = new CornDodgersCustomization(order);
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is CowboyCoffee)
                 {
                     var screen = new CowboyCoffeeCustomization(order);
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is CowpokeChili)
                 {
                     var screen = new CowpokeChiliCustomization();
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is DakotaDoubleBurger)
                 {
                     var screen = new DakotaDoubleBurgerCustomization();
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is JerkedSoda)
                 {
                     var screen = new JerkedSodaCustomization(order);
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is PanDeCampo)
                 {
                     var screen = new PanDeCampoCustomization(order);
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is TexasTea)
                 {
                     var screen = new TexasTeaCustomization(order);
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is TexasTripleBurger)
                 {
                     var screen = new TexasTripleBurgerCustomization();
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is TrailBurger)
                 {
                     var screen = new TrailBurgerCustomization();
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
                 if (i is Water)
                 {
                     var screen = new WaterCustomization(order);
                     screen.DataContext = i;
                     ordercontrol?.SwapScreen(screen);
                 }
             }
         }
     }
 }
示例#12
0
        /// <summary>
        /// Event Handler for item selection on the Order Summary Control ListBox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SelectionClicked(object sender, SelectionChangedEventArgs e)
        {
            if (sender is ListBox list)
            {
                if (list.SelectedItem is IOrderItem item)
                {
                    /*********************Entree Selection*********************/
                    if (item is AngryChicken angry)
                    {
                        var screen = new AngryChickenCustomization();
                        screen.DataContext = angry;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is CowpokeChili cowpoke)
                    {
                        var screen = new CowpokeChiliCustomization();
                        screen.DataContext = cowpoke;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is RustlersRibs rustlers)
                    {
                        var screen = new RustlersRibsCustomization();
                        screen.DataContext = rustlers;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is PecosPulledPork pecos)
                    {
                        var screen = new PecosPulledPorkCustomization();
                        screen.DataContext = pecos;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is DakotaDoubleBurger dakota)
                    {
                        var screen = new DakotaDoubleBurgerCustomization();
                        screen.DataContext = dakota;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is TrailBurger trail)
                    {
                        var screen = new TrailBurgerCustomization();
                        screen.DataContext = trail;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is TexasTripleBurger texas)
                    {
                        var screen = new TexasTripleBurgerCustomization();
                        screen.DataContext = texas;
                        orderControl       = this.FindAncestor <OrderControl>();
                        orderControl?.SwapScreen(screen);
                    }

                    /*********************Side Selection*********************/
                    if (item is BakedBeans baked)
                    {
                        var screen = new SideCustomization(DataContext);
                        screen.DataContext = baked;
                        orderControl       = this.FindAncestor <OrderControl>();
                        screen.ButtonSwitch(baked.Size);
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is ChiliCheeseFries chili)
                    {
                        var screen = new SideCustomization(DataContext);
                        screen.DataContext = chili;
                        orderControl       = this.FindAncestor <OrderControl>();
                        screen.ButtonSwitch(chili.Size);
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is CornDodgers corn)
                    {
                        var screen = new SideCustomization(DataContext);
                        screen.DataContext = corn;
                        orderControl       = this.FindAncestor <OrderControl>();
                        screen.ButtonSwitch(corn.Size);
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is PanDeCampo pan)
                    {
                        var screen = new SideCustomization(DataContext);
                        screen.DataContext = pan;
                        orderControl       = this.FindAncestor <OrderControl>();
                        screen.ButtonSwitch(pan.Size);
                        orderControl?.SwapScreen(screen);
                    }

                    /*********************Drink Selection*********************/
                    if (item is CowboyCoffee cowboy)
                    {
                        var screen = new CowboyCoffeeCustomization(DataContext);
                        screen.DataContext = cowboy;
                        orderControl       = this.FindAncestor <OrderControl>();
                        screen.ButtonSizeSwitch(cowboy.Size);
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is JerkedSoda jerked)
                    {
                        var screen = new JerkedSodaCustomization(DataContext);
                        screen.DataContext = jerked;
                        orderControl       = this.FindAncestor <OrderControl>();
                        screen.ButtonSizeSwitch(jerked.Size);
                        screen.ButtonFlavorSwitch(jerked.Flavor);
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is TexasTea texasTea)
                    {
                        var screen = new TexasTeaCustomization(DataContext);
                        screen.DataContext = texasTea;
                        orderControl       = this.FindAncestor <OrderControl>();
                        screen.ButtonSizeSwitch(texasTea.Size);
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is Water water)
                    {
                        var screen = new WaterCustomization(DataContext);
                        screen.DataContext = water;
                        orderControl       = this.FindAncestor <OrderControl>();
                        screen.ButtonSizeSwitch(water.Size);
                        orderControl?.SwapScreen(screen);
                    }
                }
            }
        }
示例#13
0
        private void PreviousItemSelection(object sender, SelectionChangedEventArgs e)
        {
            if (DataContext is Order data)
            {
                if (sender is ListBox)
                {
                    IOrderItem       item   = ((sender as ListBox).SelectedItem as IOrderItem);
                    FrameworkElement screen = null;
                    var orderControl        = this.FindAncestor <OrderControl>();

                    //Cast sender to button
                    ListBox b    = (ListBox)sender;
                    string  text = item.ToString();
                    //Filter which button was pressed based on name
                    switch (text)
                    {
                    case "Angry Chicken":
                        screen = new AngryChickenCustomization(DataContext);
                        break;

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

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

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

                    case "Rustler's Ribs":
                        screen = new RustlersRibsCustomization();
                        break;

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

                    case "Trail Burger":
                        screen = new TrailBurgerCustomization(DataContext);
                        break;

                    case "Small Baked Beans":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Medium Baked Beans":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Large Baked Beans":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Small Chili Cheese Fries":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Medium Chili Cheese Fries":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Large Chili Cheese Fries":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Small Corn Dodgers":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Medium Corn Dodgers":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Large Corn Dodgers":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Small Pan De Campo":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Medium Pan De Campo":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Large Pan De Campo":
                        screen = new SideSizeCustomization(DataContext);
                        break;

                    case "Small Cowboy Coffee":
                        screen = new CowboyCoffeeCustomization(DataContext);
                        break;

                    case "Medium Cowboy Coffee":
                        screen = new CowboyCoffeeCustomization(DataContext);
                        break;

                    case "Large Cowboy Coffee":
                        screen = new CowboyCoffeeCustomization(DataContext);
                        break;

                    case "Small Decaf Cowboy Coffee":
                        screen = new CowboyCoffeeCustomization(DataContext);
                        break;

                    case "Medium Decaf Cowboy Coffee":
                        screen = new CowboyCoffeeCustomization(DataContext);
                        break;

                    case "Large Decaf Cowboy Coffee":
                        screen = new CowboyCoffeeCustomization(DataContext);
                        break;

                    case "Small Jerked Soda":
                        screen = new JerkedSodaCustomization(DataContext);
                        break;

                    case "Medium Jerked Soda":
                        screen = new JerkedSodaCustomization(DataContext);
                        break;

                    case "Large Jerked Soda":
                        screen = new JerkedSodaCustomization(DataContext);
                        break;

                    case "Small Texas Tea":
                        screen = new TexasTeaCustomization(DataContext);
                        break;

                    case "Medium Texas Tea":
                        screen = new TexasTeaCustomization(DataContext);
                        break;

                    case "Large Texas Tea":
                        screen = new TexasTeaCustomization(DataContext);
                        break;

                    case "Small Water":
                        screen = new WaterCustomization(DataContext);
                        break;

                    case "Medium Water":
                        screen = new WaterCustomization(DataContext);
                        break;

                    case "Large Water":
                        screen = new WaterCustomization(DataContext);
                        break;

                    default:
                        throw new NotImplementedException("Unknown button clicked");
                    }
                    if (screen != null)
                    {
                        screen.DataContext = item;
                    }
                    orderControl?.SwapScreen(screen);
                }
            }
        }
示例#14
0
        private void EditItemClick(object sender, SelectionChangedEventArgs e)
        {
            if (OrderList.SelectedItem == null)
            {
                return;
            }
            string itemString = OrderList.SelectedItem.ToString();

            if (itemString.Contains("Rustler's Ribs"))
            {
                var          orderControl = this.FindAncestor <OrderControl>();
                RustlersRibs item         = e.AddedItems[0] as RustlersRibs;
                if (DataContext is Order order)
                {
                    var screen = new RustlersRibsCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Pecos Pulled Pork"))
            {
                var             orderControl = this.FindAncestor <OrderControl>();
                PecosPulledPork item         = e.AddedItems[0] as PecosPulledPork;
                if (DataContext is Order order)
                {
                    var screen = new PecosPulledPordCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Angry Chicken"))
            {
                var          orderControl = this.FindAncestor <OrderControl>();
                AngryChicken item         = e.AddedItems[0] as AngryChicken;
                if (DataContext is Order order)
                {
                    var screen = new AngryChickenCustiomiztion();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Cowpoke Chili"))
            {
                var          orderControl = this.FindAncestor <OrderControl>();
                CowpokeChili item         = e.AddedItems[0] as CowpokeChili;
                if (DataContext is Order order)
                {
                    var screen = new CowpokeChiliCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Trail Burger"))
            {
                var         orderControl = this.FindAncestor <OrderControl>();
                TrailBurger item         = e.AddedItems[0] as TrailBurger;
                if (DataContext is Order order)
                {
                    var screen = new TrailBurgerCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Dakota Double Burger"))
            {
                var orderControl        = this.FindAncestor <OrderControl>();
                DakotaDoubleBurger item = e.AddedItems[0] as DakotaDoubleBurger;
                if (DataContext is Order order)
                {
                    var screen = new DakotaDoubleBurgerCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Texas Triple Burger"))
            {
                var orderControl       = this.FindAncestor <OrderControl>();
                TexasTripleBurger item = e.AddedItems[0] as TexasTripleBurger;
                if (DataContext is Order order)
                {
                    var screen = new TexasTripleBurgerCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Chili Cheese Fries"))
            {
                var orderControl      = this.FindAncestor <OrderControl>();
                ChiliCheeseFries item = e.AddedItems[0] as ChiliCheeseFries;
                if (DataContext is Order order)
                {
                    var screen = new ChiliCheeseFriesCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Corn Dodgers"))
            {
                var         orderControl = this.FindAncestor <OrderControl>();
                CornDodgers item         = e.AddedItems[0] as CornDodgers;
                if (DataContext is Order order)
                {
                    var screen = new CornDodgersCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Pan de Campo"))
            {
                var        orderControl = this.FindAncestor <OrderControl>();
                PanDeCampo item         = e.AddedItems[0] as PanDeCampo;
                if (DataContext is Order order)
                {
                    var screen = new PanDeCampoCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Baked Beans"))
            {
                var        orderControl = this.FindAncestor <OrderControl>();
                BakedBeans item         = e.AddedItems[0] as BakedBeans;
                if (DataContext is Order order)
                {
                    var screen = new BakedBeansCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Jerked Soda"))
            {
                var        orderControl = this.FindAncestor <OrderControl>();
                JerkedSoda item         = e.AddedItems[0] as JerkedSoda;
                if (DataContext is Order order)
                {
                    var screen = new JerkedSodaCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Cowboy Coffee"))
            {
                var          orderControl = this.FindAncestor <OrderControl>();
                CowboyCoffee item         = e.AddedItems[0] as CowboyCoffee;
                if (DataContext is Order order)
                {
                    var screen = new CowboyCoffeeCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Tea"))
            {
                var      orderControl = this.FindAncestor <OrderControl>();
                TexasTea item         = e.AddedItems[0] as TexasTea;
                if (DataContext is Order order)
                {
                    var screen = new TexasTeaCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }

            if (itemString.Contains("Water"))
            {
                var   orderControl = this.FindAncestor <OrderControl>();
                Water item         = e.AddedItems[0] as Water;
                if (DataContext is Order order)
                {
                    var screen = new WaterCustomization();
                    screen.DataContext = item;
                    orderControl?.SwapScreen(screen);
                }
            }
        }
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var item = (sender as ListBox).SelectedItem;

            if (item == null)
            {
                return;
            }

            if (item is AngryChicken)
            {
                var screen = new AngryChickenCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is BakedBeans)
            {
                var screen = new BakedBeansCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is ChiliCheeseFries)
            {
                var screen = new ChiliCheeseFriesCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is CornDodgers)
            {
                var screen = new CornDodgersCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is CowboyCoffee)
            {
                var screen = new CowboyCoffeeCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is CowpokeChili)
            {
                var screen = new CowpokeChiliCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is DakotaDoubleBurger)
            {
                var screen = new DakotaDoubleBurgerCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is JerkedSoda)
            {
                var screen = new JerkedSodaCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is PanDeCampo)
            {
                var screen = new PanDeCampoCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is PecosPulledPork)
            {
                var screen = new PecosPulledPorkCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is TexasTea)
            {
                var screen = new TexasTeaCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is TexasTripleBurger)
            {
                var screen = new TexasTripleBurgerCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is TrailBurger)
            {
                var screen = new TrailBurgerCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else if (item is Water)
            {
                var screen = new WaterCustomization();
                (screen as FrameworkElement).DataContext = item;
                var orderControl = this.FindAncestor <OrderControl>();
                orderControl?.SwapScreen(screen as FrameworkElement);
            }
            else
            {
                return;
            }
        }
        /// <summary>
        /// Accesses an existing list item for the order, allowing the user to change the details of that order.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListItemSelected(object sender, SelectionChangedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();
            var selectedItem = (sender as ListBox).SelectedItem as IOrderItem;

            FrameworkElement screen = null;

            if (selectedItem != null)
            {
                switch (selectedItem.ToString())
                {
                case "Angry Chicken":
                    screen             = new AngryChickenCustomization();
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;

                case "Cowpoke Chili":

                    screen             = new CowpokeChiliCustomization();
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;

                case "Dakota Double Burger":

                    screen             = new DakotaDoubleBurgerCustomization();
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;

                case "Pecos Pulled Pork":

                    screen             = new PecosPulledPorkCustomization();
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;

                case "Trail Burger":

                    screen             = new TrailBurgerCustomization();
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;

                case "Texas Triple Burger":

                    screen             = new TexasTripleBurgerCustomization();
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;

                case "Small Baked Beans":
                case "Medium Baked Beans":
                case "Large Baked Beans":
                case "Small Chili Cheese Fries":
                case "Medium Chili Cheese Fries":
                case "Large Chili Cheese Fries":
                case "Small Corn Dodgers":
                case "Medium Corn Dodgers":
                case "Large Corn Dodgers":
                case "Small Pan De Campo":
                case "Medium Pan De Campo":
                case "Large Pan De Campo":

                    screen             = new SizeCustomization(DataContext);
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;

                case "Small Cowboy Coffee":
                case "Small Decaf Cowboy Coffee":
                case "Medium Cowboy Coffee":
                case "Medium Decaf Cowboy Coffee":
                case "Large Cowboy Coffee":
                case "Large Decaf Cowboy Coffee":
                    screen             = new CowboyCoffeeCustomization(DataContext);
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;

                case "Small Texas Sweet Tea":
                case "Small Texas Plain Tea":
                case "Medium Texas Sweet Tea":
                case "Medium Texas Plain Tea":
                case "Large Texas Sweet Tea":
                case "Large Texas Plain Tea":
                    screen             = new TexasTeaCustomization(DataContext);
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;

                case "Small Water":
                case "Medium Water":
                case "Large Water":
                    screen             = new WaterCustomization(DataContext);
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;

                //Jerked Soda is set as default because it has 15 cases.
                default:
                    screen             = new JerkedSodaCustomization(DataContext);
                    screen.DataContext = selectedItem;
                    orderControl?.SwapScreen(screen);
                    break;
                }
            }
        }
示例#17
0
        public void OnAddOrderItemButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    IOrderItem       item;
                    FrameworkElement screen = null;
                    switch (button.Tag)
                    {
                    //cases for entrees
                    case "CowpokeChili":

                        item               = new CowpokeChili();
                        screen             = new CowpokeChiliCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "AngryChicken":

                        item               = new AngryChicken();
                        screen             = new AngryChickenCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "DakotaDoubleBurger":

                        item               = new DakotaDoubleBurger();
                        screen             = new DakotaDoubleBurgerCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "PecosPulledPork":

                        item               = new PecosPulledPork();
                        screen             = new PecosPulledPorkCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "TrailBurger":

                        item               = new TrailBurger();
                        screen             = new TrailBurgerCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "TexasTripleBurger":

                        item               = new TexasTripleBurger();
                        screen             = new TexasTripleBurgerCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    // No screenswap is needed as the Ribs have no special instructions
                    case "RustlersRibs":

                        item = new RustlersRibs();
                        order.Add(item);
                        break;


                    // Separator for Sides

                    case "BakedBeans":
                        item               = new BakedBeans();
                        screen             = new SizeCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "ChiliCheeseFries":
                        item               = new ChiliCheeseFries();
                        screen             = new SizeCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "CornDodgers":
                        item               = new CornDodgers();
                        screen             = new SizeCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "PanDeCampo":
                        item               = new PanDeCampo();
                        screen             = new SizeCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    // And finally drinks

                    case "Water":
                        item               = new Water();
                        screen             = new WaterCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "JerkedSoda":
                        item               = new JerkedSoda();
                        screen             = new JerkedSodaCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "CowboyCoffee":
                        item               = new CowboyCoffee();
                        screen             = new CowboyCoffeeCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "TexasTea":
                        item               = new TexasTea();
                        screen             = new TexasTeaCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Allows customization of selected item from summary control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void OnItemSelection(object sender, SelectionChangedEventArgs args)
        {
            FrameworkElement screen;
            OrderControl     orderControl = null;

            // Need ancestor to load customization screen
            orderControl = this.FindAncestor <OrderControl>();

            if (orderControl == null)
            {
                throw new Exception("An ancestor of OrderControl expected");
            }

            // Entrees ---------------------------------------------------------------------
            if (orderList.SelectedItem is IOrderItem item)
            {
                if (item is AngryChicken angryChicken)
                {
                    screen = new AngryChickenCustomization(angryChicken);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = angryChicken;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is CowpokeChili cowpokeChili)
                {
                    screen = new CowpokeChiliCustomization(cowpokeChili);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = cowpokeChili;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is DakotaDoubleBurger dakotaDouble)
                {
                    screen = new DakotaDoubleBurgerCustomization(dakotaDouble);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = dakotaDouble;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is PecosPulledPork pecosPulledPork)
                {
                    screen = new PecosPulledPorkCustomization(pecosPulledPork);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = pecosPulledPork;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is TexasTripleBurger texasTriple)
                {
                    screen = new TexasTripleBurgerCustomization(texasTriple);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = texasTriple;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is TrailBurger trailBurger)
                {
                    screen = new TrailBurgerCustomization(trailBurger);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = trailBurger;
                        orderControl.SwapScreen(screen);
                    }
                }

                // Sides ---------------------------------------------------------------------
                else if (orderList.SelectedItem is BakedBeans bakedBeans)
                {
                    screen = new BakedBeansCustomization(bakedBeans);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = bakedBeans;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is ChiliCheeseFries chiliCheeseFries)
                {
                    screen = new ChiliCheeseFriesCustomization(chiliCheeseFries);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = chiliCheeseFries;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is CornDodgers cornDodgers)
                {
                    screen = new CornDodgersCustomization(cornDodgers);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = cornDodgers;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is PanDeCampo panDeCampo)
                {
                    screen = new PandeCampoCustomization(panDeCampo);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = panDeCampo;
                        orderControl.SwapScreen(screen);
                    }
                }

                // Drinks ---------------------------------------------------------------------
                else if (orderList.SelectedItem is CowboyCoffee cowboyCoffee)
                {
                    screen = new CowboyCoffeeCustomization(cowboyCoffee);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = cowboyCoffee;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is JerkedSoda jerkedSoda)
                {
                    screen = new JerkedSodaCustomization(jerkedSoda);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = jerkedSoda;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is TexasTea texasTea)
                {
                    screen = new TexasTeaCustomization(texasTea);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = texasTea;
                        orderControl.SwapScreen(screen);
                    }
                }
                else if (orderList.SelectedItem is Water water)
                {
                    screen = new WaterCustomization(water);
                    if (screen != null)
                    {
                        // Add item to customization screen
                        screen.DataContext = water;
                        orderControl.SwapScreen(screen);
                    }
                }

                // All else ---------------------------------------------------------------------
                else
                {
                    // Add item to customization screen
                    orderControl?.SwapScreen(new MenuItemSelectionControl());
                }
                orderList.SelectedItem = null;
            }
        }
        public void ChangeExistingItem(object sender, SelectionChangedEventArgs e)
        {
            var ancestor = this.FindAncestor <OrderControl>();

            if (ancestor == null)
            {
                return;
            }

            foreach (object i in e.AddedItems)
            {
                if (i is AngryChicken)
                {
                    var screen = new AngryChickenCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is CowboyCoffee)
                {
                    var screen = new CowboyCoffeCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is CowpokeChili)
                {
                    var screen = new CowpokeChiliCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is DakotaDoubleBurger)
                {
                    var screen = new DakotaDoubleCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is JerkedSoda)
                {
                    var screen = new JerkedSodaCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is PecosPulledPork)
                {
                    var screen = new PecosPulledPorkCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is PanDeCampo || i is BakedBeans || i is ChiliCheeseFries || i is CornDodgers)
                {
                    var screen = new SideCustomizations();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is CowpokeChili)
                {
                    var screen = new CowpokeChiliCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is TexasTea)
                {
                    var screen = new TexasTeaCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is TexasTripleBurger)
                {
                    var screen = new TexasTripleCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is TrailBurger)
                {
                    var screen = new TrailBurgerCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
                else if (i is Water)
                {
                    var screen = new WaterCustomization();
                    screen.DataContext = i;
                    ancestor.SwapScreen(screen);
                }
            }
        }
示例#20
0
        /// <summary>
        /// Replaces the MenuItemSelectionControl in the OrderControl parent
        /// with a customization screen of the selected ListBox's DataContext
        /// thus allowing the user to edit previously added order items.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var selectedItem = (sender as ListBox).SelectedItem;
            var orderControl = this.FindAncestor <OrderControl>();

            // Replace the MenuItemSelectionControl with a customization screen
            // that matches the object type of the DataContext of the selectedItem
            // and set the customization screen's DataContext to the DataContext
            // of the selectedItem.
            if (selectedItem is AngryChicken angryChickenItem)
            {
                var angryChickenScreen = new AngryChickenCustomization();
                angryChickenScreen.DataContext = angryChickenItem;
                orderControl?.SwapScreen(angryChickenScreen);
            }
            else if (selectedItem is BakedBeans bakedBeansItem)
            {
                var bakedBeansScreen = new BakedBeansCustomization();
                bakedBeansScreen.DataContext = bakedBeansItem;

                // Check the appropriate size radio button on the bakedBeansScreen.
                switch ((selectedItem as BakedBeans).Size)
                {
                case CowboyCafe.Data.Size.Large:
                    bakedBeansScreen.SizeLarge.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Medium:
                    bakedBeansScreen.SizeMedium.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Small:
                    bakedBeansScreen.SizeSmall.IsChecked = true;
                    break;

                default:
                    throw new NotImplementedException("Unknown Size");
                }

                orderControl?.SwapScreen(bakedBeansScreen);
            }
            else if (selectedItem is ChiliCheeseFries chiliCheeseFriesItem)
            {
                var chiliCheeseFriesScreen = new ChiliCheeseFriesCustomization();
                chiliCheeseFriesScreen.DataContext = chiliCheeseFriesItem;


                // Check the appropriate size radio button on the chiliCheeseFriesScreen.
                switch ((selectedItem as ChiliCheeseFries).Size)
                {
                case CowboyCafe.Data.Size.Large:
                    chiliCheeseFriesScreen.SizeLarge.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Medium:
                    chiliCheeseFriesScreen.SizeMedium.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Small:
                    chiliCheeseFriesScreen.SizeSmall.IsChecked = true;
                    break;

                default:
                    throw new NotImplementedException("Unknown Size");
                }

                orderControl?.SwapScreen(chiliCheeseFriesScreen);
            }
            else if (selectedItem is CornDodgers cornDodgersItem)
            {
                var cornDodgersScreen = new CornDodgersCustomization();
                cornDodgersScreen.DataContext = cornDodgersItem;

                // Check the appropriate size radio button on the cornDodgersScreen.
                switch ((selectedItem as CornDodgers).Size)
                {
                case CowboyCafe.Data.Size.Large:
                    cornDodgersScreen.SizeLarge.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Medium:
                    cornDodgersScreen.SizeMedium.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Small:
                    cornDodgersScreen.SizeSmall.IsChecked = true;
                    break;

                default:
                    throw new NotImplementedException("Unknown Size");
                }

                orderControl?.SwapScreen(cornDodgersScreen);
            }
            else if (selectedItem is CowboyCoffee cowboyCoffeeItem)
            {
                var cowboyCoffeeScreen = new CowboyCoffeeCustomization();
                cowboyCoffeeScreen.DataContext = cowboyCoffeeItem;

                // Check the appropriate size radio button on the cowboyCoffeeScreen.
                switch ((selectedItem as CowboyCoffee).Size)
                {
                case CowboyCafe.Data.Size.Large:
                    cowboyCoffeeScreen.SizeLarge.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Medium:
                    cowboyCoffeeScreen.SizeMedium.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Small:
                    cowboyCoffeeScreen.SizeSmall.IsChecked = true;
                    break;

                default:
                    throw new NotImplementedException("Unknown Size");
                }

                orderControl?.SwapScreen(cowboyCoffeeScreen);
            }
            else if (selectedItem is CowpokeChili cowpokeChiliItem)
            {
                var cowpokeChiliScreen = new CowpokeChiliCustomization();
                cowpokeChiliScreen.DataContext = cowpokeChiliItem;
                orderControl?.SwapScreen(cowpokeChiliScreen);
            }
            else if (selectedItem is DakotaDoubleBurger dakotaDoubleBurgerItem)
            {
                var dakotaDoubleBurgerScreen = new DakotaDoubleBurgerCustomization();
                dakotaDoubleBurgerScreen.DataContext = dakotaDoubleBurgerItem;
                orderControl?.SwapScreen(dakotaDoubleBurgerScreen);
            }
            else if (selectedItem is JerkedSoda jerkedSodaItem)
            {
                var jerkedSodaScreen = new JerkedSodaCustomization();
                jerkedSodaScreen.DataContext = jerkedSodaItem;

                // Check the appropriate flavor radio button on the jerkedSodaScreen.
                switch ((selectedItem as JerkedSoda).Flavor)
                {
                case CowboyCafe.Data.SodaFlavor.CreamSoda:
                    jerkedSodaScreen.FlavorCreamSoda.IsChecked = true;
                    break;

                case CowboyCafe.Data.SodaFlavor.OrangeSoda:
                    jerkedSodaScreen.FlavorCreamSoda.IsChecked = true;
                    break;

                case CowboyCafe.Data.SodaFlavor.Sarsaparilla:
                    jerkedSodaScreen.FlavorSarsaparilla.IsChecked = true;
                    break;

                case CowboyCafe.Data.SodaFlavor.BirchBeer:
                    jerkedSodaScreen.FlavorBirchBeer.IsChecked = true;
                    break;

                case CowboyCafe.Data.SodaFlavor.RootBeer:
                    jerkedSodaScreen.FlavorRootBeer.IsChecked = true;
                    break;

                default:
                    throw new NotImplementedException("Unknown Flavor");
                }

                // Check the appropriate size radio button on the jerkedSodaScreen.
                switch ((selectedItem as JerkedSoda).Size)
                {
                case CowboyCafe.Data.Size.Large:
                    jerkedSodaScreen.SizeLarge.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Medium:
                    jerkedSodaScreen.SizeMedium.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Small:
                    jerkedSodaScreen.SizeSmall.IsChecked = true;
                    break;

                default:
                    throw new NotImplementedException("Unknown Size");
                }

                orderControl?.SwapScreen(jerkedSodaScreen);
            }
            else if (selectedItem is PanDeCampo panDeCampoItem)
            {
                var panDeCampoScreen = new PanDeCampoCustomization();
                panDeCampoScreen.DataContext = panDeCampoItem;

                // Check the appropriate size radio button on the panDeCampoScreen.
                switch ((selectedItem as PanDeCampo).Size)
                {
                case CowboyCafe.Data.Size.Large:
                    panDeCampoScreen.SizeLarge.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Medium:
                    panDeCampoScreen.SizeMedium.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Small:
                    panDeCampoScreen.SizeSmall.IsChecked = true;
                    break;

                default:
                    throw new NotImplementedException("Unknown Size");
                }

                orderControl?.SwapScreen(panDeCampoScreen);
            }
            else if (selectedItem is PecosPulledPork pecosPulledPorkItem)
            {
                var pecosPulledPorkScreen = new PecosPulledPorkCustomization();
                pecosPulledPorkScreen.DataContext = pecosPulledPorkItem;
                orderControl?.SwapScreen(pecosPulledPorkScreen);
            }
            else if (selectedItem is RustlersRibs rustlersRibsItem)
            {
                var rustlersRibsScreen = new RustlersRibsCustomization();
                rustlersRibsScreen.DataContext = rustlersRibsItem;
                orderControl?.SwapScreen(rustlersRibsScreen);
            }
            else if (selectedItem is TexasTea texasTeaItem)
            {
                var texasTeaScreen = new TexasTeaCustomization();
                texasTeaScreen.DataContext = texasTeaItem;

                // Check the appropriate size radio button on the texasTeaScreen.
                switch ((selectedItem as TexasTea).Size)
                {
                case CowboyCafe.Data.Size.Large:
                    texasTeaScreen.SizeLarge.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Medium:
                    texasTeaScreen.SizeMedium.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Small:
                    texasTeaScreen.SizeSmall.IsChecked = true;
                    break;

                default:
                    throw new NotImplementedException("Unknown Size");
                }

                orderControl?.SwapScreen(texasTeaScreen);
            }
            else if (selectedItem is TexasTripleBurger texasTripleBurgerItem)
            {
                var texasTripleBurgerScreen = new TexasTripleBurgerCustomization();
                texasTripleBurgerScreen.DataContext = texasTripleBurgerItem;
                orderControl?.SwapScreen(texasTripleBurgerScreen);
            }
            else if (selectedItem is TrailBurger trailBurgerItem)
            {
                var trailBurgerScreen = new TrailBurgerCustomization();
                trailBurgerScreen.DataContext = trailBurgerItem;
                orderControl?.SwapScreen(trailBurgerScreen);
            }
            else if (selectedItem is Water waterItem)
            {
                var waterScreen = new WaterCustomization();
                waterScreen.DataContext = waterItem;

                // Check the appropriate size radio button on the waterScreen.
                switch ((selectedItem as Water).Size)
                {
                case CowboyCafe.Data.Size.Large:
                    waterScreen.SizeLarge.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Medium:
                    waterScreen.SizeMedium.IsChecked = true;
                    break;

                case CowboyCafe.Data.Size.Small:
                    waterScreen.SizeSmall.IsChecked = true;
                    break;

                default:
                    throw new NotImplementedException("Unknown Size");
                }

                orderControl?.SwapScreen(waterScreen);
            }
        }
        private void MenuButton_Click(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Content)
                    {
                    case "Cowpoke Chili":
                        var chiliItem   = new CowpokeChili();
                        var chiliScreen = new CowpokeChiliCustomization();
                        chiliScreen.DataContext = chiliItem;
                        order.Add(chiliItem);
                        orderControl?.SwapScreen(chiliScreen);
                        break;

                    case "Angry Chicken":
                        var chickenItem   = new AngryChicken();
                        var chickenScreen = new AngryChickenCustomization();
                        chickenScreen.DataContext = chickenItem;
                        order.Add(chickenItem);
                        orderControl?.SwapScreen(chickenScreen);
                        break;

                    case "Dakota Double Burger":
                        var doubleItem   = new DakotaDoubleBurger();
                        var doubleScreen = new DakotaDoubleBurgerCustomization();
                        doubleScreen.DataContext = doubleItem;
                        order.Add(doubleItem);
                        orderControl?.SwapScreen(doubleScreen);
                        break;

                    case "Pecos Pulled Pork":
                        var pecosItem   = new PecosPulledPork();
                        var pecosScreen = new PecosPulledPorkCustomization();
                        pecosScreen.DataContext = pecosItem;
                        order.Add(pecosItem);
                        orderControl?.SwapScreen(pecosScreen);
                        break;

                    case "Rustler's Ribs":
                        var ribsItem   = new RustlersRibs();
                        var ribsScreen = new RustlersRibsCustomization();
                        ribsScreen.DataContext = ribsItem;
                        order.Add(ribsItem);
                        orderControl?.SwapScreen(ribsScreen);
                        break;

                    case "Texas Triple Burger":
                        var tripleItem   = new TexasTripleBurger();
                        var tripleScreen = new TexasTripleBurgerCustomization();
                        tripleScreen.DataContext = tripleItem;
                        order.Add(tripleItem);
                        orderControl?.SwapScreen(tripleScreen);
                        break;

                    case "Trail Burger":
                        var burgerItem   = new TrailBurger();
                        var burgerScreen = new TrailBurgerCustomization();
                        burgerScreen.DataContext = burgerItem;
                        order.Add(burgerItem);
                        orderControl?.SwapScreen(burgerScreen);
                        break;

                    case "Baked Beans":
                        var beansItem   = new BakedBeans();
                        var beansScreen = new SideCustomization(beansItem);
                        order.Add(beansItem);
                        orderControl?.SwapScreen(beansScreen);
                        break;

                    case "Chili Cheese Fries":
                        var friesItem   = new ChiliCheeseFries();
                        var friesScreen = new SideCustomization(friesItem);
                        order.Add(friesItem);
                        orderControl?.SwapScreen(friesScreen);
                        break;

                    case "Corn Dodgers":
                        var cornItem   = new CornDodgers();
                        var cornScreen = new SideCustomization(cornItem);
                        order.Add(cornItem);
                        orderControl?.SwapScreen(cornScreen);
                        break;

                    case "Pan de Campo":
                        var panItem   = new PanDeCampo();
                        var panScreen = new SideCustomization(panItem);
                        order.Add(panItem);
                        orderControl?.SwapScreen(panScreen);
                        break;

                    case "Cowboy Coffee":
                        var coffeeItem   = new CowboyCoffee();
                        var coffeeScreen = new CowboyCoffeeCustomization(coffeeItem);
                        order.Add(coffeeItem);
                        orderControl?.SwapScreen(coffeeScreen);
                        break;

                    case "Jerked Soda":
                        var sodaItem   = new JerkedSoda();
                        var sodaScreen = new JerkedSodaCustomization(sodaItem);
                        order.Add(sodaItem);
                        orderControl?.SwapScreen(sodaScreen);
                        break;

                    case "Texas Tea":
                        var teaItem   = new TexasTea();
                        var teaScreen = new TexasTeaCustomization(teaItem);
                        order.Add(teaItem);
                        orderControl?.SwapScreen(teaScreen);
                        break;

                    case "Water":
                        var waterItem   = new Water();
                        var waterScreen = new WaterCustomization(waterItem);
                        order.Add(waterItem);
                        orderControl?.SwapScreen(waterScreen);
                        break;
                    }
                }
            }
        }
        private void ChangedSelect(object sender, SelectionChangedEventArgs args)
        {
            IOrderItem item         = ((sender as ListBox).SelectedItem as IOrderItem);
            var        orderControl = this.FindAncestor <OrderControl>();

            if (item is AngryChicken)
            {
                var screen = new AngryChickenCustomization();
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is BakedBeans)
            {
                var screen = new BakedBeansCustomization(DataContext);
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is ChiliCheeseFries)
            {
                var screen = new ChiliCheeseFriesCustomization((Order)DataContext);
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is CornDodgers)
            {
                var screen = new CornDodgersCustomization((Order)DataContext);
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is CowboyCoffee)
            {
                var screen = new CowboyCoffeeCustomization((Order)DataContext);
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is CowpokeChili)
            {
                var screen = new CowpokeChiliCustomization((Order)DataContext);
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is DakotaDoubleBurger)
            {
                var screen = new DakotaDoubleCustomization();
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is JerkedSoda)
            {
                var screen = new JerkedSodaCustomization((Order)DataContext);
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is PanDeCampo)
            {
                var screen = new PanDeCampoCustomization((Order)DataContext);
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is PecosPulledPork)
            {
                var screen = new PecosPulledPorkCustomization();
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is RustlersRibs)
            {
                var screen = new RustlersRibsCustomization();
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is TexasTea)
            {
                var screen = new TexasTeaCustomization((Order)DataContext);
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is TexasTripleBurger)
            {
                var screen = new TexasTripleBurgerCustomization();
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is TrailBurger)
            {
                var screen = new TrailBurgerCustomization();
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
            if (item is Water)
            {
                var screen = new WaterCustomization((Order)DataContext);
                screen.DataContext = item;
                orderControl?.SwapScreen(screen);
            }
        }
        /// <summary>
        /// Opens the selection screen when a panel is selected in the list box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        private void MainBox_SelectionChanged(object sender, RoutedEventArgs arg)
        {
            if (DataContext is Order order)
            {
                if (sender is ListBox box)
                {
                    var orderControl = this.FindAncestor <OrderControl>();
                    if (box.SelectedItem is IOrderItem item)
                    {
                        FrameworkElement screen = null;

                        //Entrees

                        if (item is AngryChicken)
                        {
                            screen = new AngryChickenCustomization();
                        }
                        if (item is CowpokeChili)
                        {
                            screen = new CowpokeChiliCustomization();
                        }
                        if (item is PecosPulledPork)
                        {
                            screen = new PecosPulledPorkCustomization();
                        }
                        if (item is RustlersRibs)
                        {
                            screen = new RustlersRibsCustomization();
                        }
                        if (item is TrailBurger)
                        {
                            screen = new TrailBurgerCustomization();
                        }
                        if (item is TexasTripleBurger)
                        {
                            screen = new TexasTripleBurgerCustomization();
                        }
                        if (item is DakotaDoubleBurger)
                        {
                            screen = new DakotaDoubleBurgerCustomization();
                        }

                        //Sides

                        if (item is PanDeCampo)
                        {
                            screen = new PanDeCampoCustomization();
                        }
                        if (item is CornDodgers)
                        {
                            screen = new CornDodgersCustomization();
                        }
                        if (item is BakedBeans)
                        {
                            screen = new BakedBeansCustomization();
                        }
                        if (item is ChiliCheeseFries)
                        {
                            screen = new ChiliCheeseFriesCustomization();
                        }

                        //Drinks

                        if (item is JerkedSoda)
                        {
                            screen = new JerkedSodaCustomization();
                        }
                        if (item is CowboyCoffee)
                        {
                            screen = new CowboyCoffeeCustomization();
                        }
                        if (item is Water)
                        {
                            screen = new WaterCustomization();
                        }
                        if (item is TexasTea)
                        {
                            screen = new TexasTeaCustomization();
                        }

                        screen.DataContext = item;
                        orderControl?.SwapScreen(screen);
                    }
                }
            }
        }
示例#24
0
        /// <summary>
        /// This method adds entrees to the list by converting the
        /// sender object to a button and filtering on the name of the button
        /// that was pressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddItemToList(object sender, RoutedEventArgs e)
        {
            //Ensure the DataContext is an Order and not NULL
            if (DataContext is Order data)
            {
                if (sender is Button)
                {
                    IOrderItem       item;
                    FrameworkElement screen = null;
                    var orderControl        = this.FindAncestor <OrderControl>();

                    //Cast sender to button
                    Button b = (Button)sender;

                    //Filter which button was pressed based on name
                    switch (b.Name)
                    {
                    case "AddAngryChickenButton":
                        item   = new AngryChicken();
                        screen = new AngryChickenCustomization(DataContext);
                        break;

                    case "AddCowpokeChiliButton":
                        item   = new CowpokeChili();
                        screen = new CowpokeChiliCustomization(DataContext);
                        break;

                    case "AddDakotaDoubleBurgerButton":
                        item   = new DakotaDoubleBurger();
                        screen = new DakotaDoubleCustomization(DataContext);
                        break;

                    case "AddPecosPulledPorkButton":
                        item   = new PecosPulledPork();
                        screen = new PecosPulledPorkCustomization(DataContext);
                        break;

                    case "AddRustlersRibsButton":
                        item = new RustlersRibs();
                        break;

                    case "AddTexasTripleBurgerButton":
                        item   = new TexasTripleBurger();
                        screen = new TexasTripleCustomization(DataContext);
                        break;

                    case "AddTrailBurgerButton":
                        item   = new TrailBurger();
                        screen = new TrailBurgerCustomization(DataContext);
                        break;

                    case "AddBakedBeansButton":
                        item = new BakedBeans();
                        break;

                    case "AddChiliCheeseFriesButton":
                        item = new ChiliCheeseFries();
                        break;

                    case "AddCornDodgersButton":
                        item = new CornDodgers();
                        break;

                    case "AddPandeCampoButton":
                        item = new PanDeCampo();
                        break;

                    case "AddCowboyCoffeeButton":
                        item   = new CowboyCoffee();
                        screen = new CowboyCoffeeCustomization(DataContext);
                        break;

                    case "AddJerkedSodaButton":
                        item   = new JerkedSoda();
                        screen = new JerkedSodaCustomization(DataContext);
                        break;

                    case "AddTexasTeaButton":
                        item   = new TexasTea();
                        screen = new TexasTeaCustomization(DataContext);
                        break;

                    case "AddWaterButton":
                        item   = new Water();
                        screen = new WaterCustomization(DataContext);
                        break;

                    default:
                        throw new NotImplementedException("Unknown button clicked");
                    }
                    if (screen != null)
                    {
                        screen.DataContext = item;
                    }
                    data.Add(item);
                    orderControl?.SwapScreen(screen);
                }
            }
        }
示例#25
0
        /// <summary>
        /// takes in an item and finds the corresponding screen for it and then applies the context to it
        /// </summary>
        /// <param name="item">menu item</param>
        /// <returns>returns the screen with the context</returns>
        private FrameworkElement SwapScreenHelper(object item)
        {
            FrameworkElement screen = new MenuItemSelectionControl();

            if (item is AngryChicken)
            {
                screen             = new AngryChickenCustomization();
                screen.DataContext = item;
            }
            else if (item is CowpokeChili)
            {
                screen             = new CowpokeChiliCustomization();
                screen.DataContext = item;
            }
            else if (item is RustlersRibs)
            {
                screen             = new RustlersRibsCustomization();
                screen.DataContext = item;
            }
            else if (item is PecosPulledPork)
            {
                screen             = new PecosPulledPorkCustomization();
                screen.DataContext = item;
            }
            else if (item is TrailBurger)
            {
                screen             = new TrailBurgerCustomization();
                screen.DataContext = item;
            }
            else if (item is DakotaDoubleBurger)
            {
                screen             = new DakotaDoubleBurgerCustomization();
                screen.DataContext = item;
            }
            else if (item is TexasTripleBurger)
            {
                screen             = new TexasTripleBurgerCustomization();
                screen.DataContext = item;
            }
            else if (item is PanDeCampo)
            {
                screen             = new PanDeCampoCustomization();
                screen.DataContext = item;
            }
            else if (item is CornDodgers)
            {
                screen             = new CornDodgersCustomization();
                screen.DataContext = item;
            }
            else if (item is ChiliCheeseFries)
            {
                screen             = new ChiliCheeseFriesCustomization();
                screen.DataContext = item;
            }
            else if (item is BakedBeans)
            {
                screen             = new BakedBeansCustomization();
                screen.DataContext = item;
            }
            else if (item is JerkedSoda)
            {
                screen             = new JerkedSodaCustomization();
                screen.DataContext = item;
            }
            else if (item is CowboyCoffee)
            {
                screen             = new CowboyCoffeeCustomization();
                screen.DataContext = item;
            }
            else if (item is TexasTea)
            {
                screen             = new TexasTeaCustomization();
                screen.DataContext = item;
            }
            else if (item is Water)
            {
                screen             = new WaterCustomization();
                screen.DataContext = item;
            }
            return(screen);
        }
        /// <summary>
        /// The event handler when an item inside of the listbox is clicked to change the screen
        /// </summary>
        /// <param name="sender">Object clicked</param>
        /// <param name="e">Event args</param>
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (List.SelectedItem == null)
            {
                return;
            }

            if (List.SelectedItem.ToString().Contains("Angry Chicken"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new AngryChickenCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Cowpoke Chili"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new CowpokeChiliCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Trail Burger"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new TrailBurgerCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Pecos Pulled Pork"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new PecosPulledPorkCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Dakota Double Burger"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new DakotaDoubleBurgerCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Texas Triple Burger"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new TexasTripleBurgerCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Baked Beans"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new BakedBeansCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Chili Cheese Fries"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new ChiliCheeseFriesCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Corn Dodgers"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new CornDodgersCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Pan de Campo"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new PanDeCampoCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Jerked Soda"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new JerkedSodaCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Texas Sweet Tea") | List.SelectedItem.ToString().Contains("Texas Plain Tea"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new TexasTeaCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Cowboy Coffee"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new CowboyCoffeeCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }

            else if (List.SelectedItem.ToString().Contains("Water"))
            {
                var orderControl = this.FindAncestor <OrderControl>();
                var screen       = new WaterCustomization();
                screen.DataContext = List.SelectedItem;
                orderControl?.SwapScreen(screen);
            }
        }
        private void ChangeItem(object sender, SelectionChangedEventArgs args)
        {
            //Entrees

            ///Cowpoke Chili
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Cowpoke Chili"))
            {
                CowpokeChili firstItem    = args.AddedItems[0] as CowpokeChili;
                var          orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new CowpokeChiliCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            ///Rustlers Ribs
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Ribs"))
            {
                RustlersRibs firstItem    = args.AddedItems[0] as RustlersRibs;
                var          orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new RustlersRibsCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            ///Pecos Pulled Pork
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Pecos"))
            {
                PecosPulledPork firstItem    = args.AddedItems[0] as PecosPulledPork;
                var             orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new PecosPulledPorkCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            ///Trailburger
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Trail Burger"))
            {
                TrailBurger firstItem    = args.AddedItems[0] as TrailBurger;
                var         orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new TrailBurgerCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            ///Dakota Double Burger
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Dakota"))
            {
                DakotaDoubleBurger firstItem = args.AddedItems[0] as DakotaDoubleBurger;
                var orderControl             = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new DakotaDoubleBurgerCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            ///Texas Triple Burger
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Triple"))
            {
                TexasTripleBurger firstItem = args.AddedItems[0] as TexasTripleBurger;
                var orderControl            = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new TexasTripleBurgerCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            ///Angry Chicken
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Angry"))
            {
                AngryChicken firstItem    = args.AddedItems[0] as AngryChicken;
                var          orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new AngryChickenCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            //Sides

            ///Chili Cheese Fries
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Chili Cheese Fries"))
            {
                ChiliCheeseFries firstItem = args.AddedItems[0] as ChiliCheeseFries;
                var orderControl           = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new ChiliCheeseFriesCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            //Corn Dodgers
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Corn Dodgers"))
            {
                CornDodgers firstItem    = args.AddedItems[0] as CornDodgers;
                var         orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new CornDodgersCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            //Baked Beans
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Baked Beans"))
            {
                BakedBeans firstItem    = args.AddedItems[0] as BakedBeans;
                var        orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new BakedBeansCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            //Pan De Campo
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Pan de Campo"))
            {
                PanDeCampo firstItem    = args.AddedItems[0] as PanDeCampo;
                var        orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new PanDeCampoCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            //Drinks

            //Jerked Soda
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Soda"))
            {
                JerkedSoda firstItem    = args.AddedItems[0] as JerkedSoda;
                var        orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new JerkedSodaCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            //Texas Tea
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Tea"))
            {
                TexasTea firstItem    = args.AddedItems[0] as TexasTea;
                var      orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new TexasTeaCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            //Cowboy Coffee
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Coffee"))
            {
                CowboyCoffee firstItem    = args.AddedItems[0] as CowboyCoffee;
                var          orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new CowboyCoffeeCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }

            //Water
            if (OrderList.SelectedItem != null && OrderList.SelectedItem.ToString().Contains("Water"))
            {
                Water firstItem    = args.AddedItems[0] as Water;
                var   orderControl = this.FindAncestor <OrderControl>();
                if (DataContext is Order order1)
                {
                    var screen = new WaterCustomization();
                    screen.DataContext = firstItem;
                    orderControl?.SwapScreen(screen);
                }
            }
        }
示例#28
0
        /// <summary>
        /// Adds the selected item to the current order and
        /// swaps the screen to the customization screen for
        /// the order item just added.
        /// </summary>
        /// <param name="sender">The clicked button.</param>
        /// <param name="args"></param>
        void OnAddOrderItemButtonClicked(object sender, RoutedEventArgs args)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    case "CowpokeChili":
                        var newChili    = new CowpokeChili();
                        var chiliScreen = new CowpokeChiliCustomization();
                        chiliScreen.DataContext = newChili;
                        order.Add(newChili);
                        orderControl?.SwapScreen(chiliScreen);
                        break;

                    case "AngryChicken":
                        var newChicken    = new AngryChicken();
                        var chickenScreen = new AngryChickenCustomization();
                        chickenScreen.DataContext = newChicken;
                        order.Add(newChicken);
                        orderControl?.SwapScreen(chickenScreen);
                        break;

                    case "RustlersRibs":
                        var newRibs    = new RustlersRibs();
                        var ribsScreen = new RustlersRibsCustomization();
                        ribsScreen.DataContext = newRibs;
                        order.Add(newRibs);
                        orderControl?.SwapScreen(ribsScreen);
                        break;

                    case "PecosPulledPork":
                        var newPork    = new PecosPulledPork();
                        var porkScreen = new PecosPulledPorkCustomization();
                        porkScreen.DataContext = newPork;
                        order.Add(newPork);
                        orderControl?.SwapScreen(porkScreen);
                        break;

                    case "TrailBurger":
                        var newTrail    = new TrailBurger();
                        var trailScreen = new TrailBurgerCustomization();
                        trailScreen.DataContext = newTrail;
                        order.Add(newTrail);
                        orderControl?.SwapScreen(trailScreen);
                        break;

                    case "DakotaDoubleBurger":
                        var newDakota    = new DakotaDoubleBurger();
                        var dakotaScreen = new DakotaDoubleBurgerCustomization();
                        dakotaScreen.DataContext = newDakota;
                        order.Add(newDakota);
                        orderControl?.SwapScreen(dakotaScreen);
                        break;

                    case "TexasTripleBurger":
                        var newTriple    = new TexasTripleBurger();
                        var tripleScreen = new TexasTripleBurgerCustomization();
                        tripleScreen.DataContext = newTriple;
                        order.Add(newTriple);
                        orderControl?.SwapScreen(tripleScreen);
                        break;

                    case "ChiliCheeseFries":
                        var newFries    = new ChiliCheeseFries();
                        var friesScreen = new ChiliCheeseFriesCustomization();
                        friesScreen.DataContext = newFries;

                        // Check the appropriate size radio button on the friesScreen.
                        switch (newFries.Size)
                        {
                        case CowboyCafe.Data.Size.Large:
                            friesScreen.SizeLarge.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Medium:
                            friesScreen.SizeMedium.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Small:
                            friesScreen.SizeSmall.IsChecked = true;
                            break;
                        }

                        order.Add(newFries);
                        orderControl?.SwapScreen(friesScreen);
                        break;

                    case "CornDodgers":
                        var newDodgers    = new CornDodgers();
                        var dodgersScreen = new CornDodgersCustomization();
                        dodgersScreen.DataContext = newDodgers;

                        // Check the appropriate size radio button on the dodgersScreen.
                        switch (newDodgers.Size)
                        {
                        case CowboyCafe.Data.Size.Large:
                            dodgersScreen.SizeLarge.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Medium:
                            dodgersScreen.SizeMedium.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Small:
                            dodgersScreen.SizeSmall.IsChecked = true;
                            break;
                        }

                        order.Add(newDodgers);
                        orderControl?.SwapScreen(dodgersScreen);
                        break;

                    case "PanDeCampo":
                        var newCampo    = new PanDeCampo();
                        var campoScreen = new PanDeCampoCustomization();
                        campoScreen.DataContext = newCampo;

                        // Check the appropriate size radio button on the camposScreen.
                        switch (newCampo.Size)
                        {
                        case CowboyCafe.Data.Size.Large:
                            campoScreen.SizeLarge.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Medium:
                            campoScreen.SizeMedium.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Small:
                            campoScreen.SizeSmall.IsChecked = true;
                            break;
                        }

                        order.Add(newCampo);
                        orderControl?.SwapScreen(campoScreen);
                        break;

                    case "BakedBeans":
                        var newBeans   = new BakedBeans();
                        var beanScreen = new BakedBeansCustomization();
                        beanScreen.DataContext = newBeans;

                        // Check the appropriate size radio button on the bakedBeansScreen.
                        switch (newBeans.Size)
                        {
                        case CowboyCafe.Data.Size.Large:
                            beanScreen.SizeLarge.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Medium:
                            beanScreen.SizeMedium.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Small:
                            beanScreen.SizeSmall.IsChecked = true;
                            break;
                        }

                        order.Add(newBeans);
                        orderControl?.SwapScreen(beanScreen);
                        break;

                    case "JerkedSoda":
                        var newSoda    = new JerkedSoda();
                        var sodaScreen = new JerkedSodaCustomization();
                        sodaScreen.DataContext = newSoda;

                        // Check the appropriate flavor radio button on the sodaScreen.
                        switch (newSoda.Flavor)
                        {
                        case CowboyCafe.Data.SodaFlavor.CreamSoda:
                            sodaScreen.FlavorCreamSoda.IsChecked = true;
                            break;

                        case CowboyCafe.Data.SodaFlavor.OrangeSoda:
                            sodaScreen.FlavorCreamSoda.IsChecked = true;
                            break;

                        case CowboyCafe.Data.SodaFlavor.Sarsaparilla:
                            sodaScreen.FlavorSarsaparilla.IsChecked = true;
                            break;

                        case CowboyCafe.Data.SodaFlavor.BirchBeer:
                            sodaScreen.FlavorBirchBeer.IsChecked = true;
                            break;

                        case CowboyCafe.Data.SodaFlavor.RootBeer:
                            sodaScreen.FlavorRootBeer.IsChecked = true;
                            break;

                        default:
                            throw new NotImplementedException("Unknown Flavor");
                        }

                        // Check the appropriate size radio button on the sodaScreen.
                        switch (newSoda.Size)
                        {
                        case CowboyCafe.Data.Size.Large:
                            sodaScreen.SizeLarge.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Medium:
                            sodaScreen.SizeMedium.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Small:
                            sodaScreen.SizeSmall.IsChecked = true;
                            break;

                        default:
                            throw new NotImplementedException("Unknown Size");
                        }

                        order.Add(newSoda);
                        orderControl?.SwapScreen(sodaScreen);
                        break;

                    case "TexasTea":
                        var newTea    = new TexasTea();
                        var teaScreen = new TexasTeaCustomization();
                        teaScreen.DataContext = newTea;

                        // Check the appropriate size radio button on the texasTeaScreen.
                        switch (newTea.Size)
                        {
                        case CowboyCafe.Data.Size.Large:
                            teaScreen.SizeLarge.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Medium:
                            teaScreen.SizeMedium.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Small:
                            teaScreen.SizeSmall.IsChecked = true;
                            break;

                        default:
                            throw new NotImplementedException("Unknown Size");
                        }

                        order.Add(newTea);
                        orderControl?.SwapScreen(teaScreen);
                        break;

                    case "CowboyCoffee":
                        var newCoffee    = new CowboyCoffee();
                        var coffeeScreen = new CowboyCoffeeCustomization();
                        coffeeScreen.DataContext = newCoffee;

                        // Check the appropriate size radio button on the coffeeScreen.
                        switch (newCoffee.Size)
                        {
                        case CowboyCafe.Data.Size.Large:
                            coffeeScreen.SizeLarge.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Medium:
                            coffeeScreen.SizeMedium.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Small:
                            coffeeScreen.SizeSmall.IsChecked = true;
                            break;

                        default:
                            throw new NotImplementedException("Unknown Size");
                        }

                        order.Add(newCoffee);
                        orderControl?.SwapScreen(coffeeScreen);
                        break;

                    case "Water":
                        var newWater    = new Water();
                        var waterScreen = new WaterCustomization();
                        waterScreen.DataContext = newWater;

                        // Check the appropriate size radio button on the waterScreen.
                        switch (newWater.Size)
                        {
                        case CowboyCafe.Data.Size.Large:
                            waterScreen.SizeLarge.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Medium:
                            waterScreen.SizeMedium.IsChecked = true;
                            break;

                        case CowboyCafe.Data.Size.Small:
                            waterScreen.SizeSmall.IsChecked = true;
                            break;

                        default:
                            throw new NotImplementedException("Unknown Size");
                        }

                        order.Add(newWater);
                        orderControl?.SwapScreen(waterScreen);
                        break;
                    }
                }
            }
        }
示例#29
0
        private void ItemsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (orderControl == null)
            {
                return;
            }
            foreach (object o in e.AddedItems)
            {
                if (o is CowpokeChili)
                {
                    var ccc = new CowpokeChiliCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is AngryChicken)
                {
                    var ccc = new AngryChickenCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is ChiliCheeseFries)
                {
                    var ccc = new ChiliCheeseFriesCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is CornDodgers)
                {
                    var ccc = new CornDodgersCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is CowboyCoffee)
                {
                    var ccc = new CowboyCoffeeCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is DakotaDoubleBurger)
                {
                    var ccc = new DakotaDoubleCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is JerkedSoda)
                {
                    var ccc = new JerkedSodaCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is PanDeCampo)
                {
                    var ccc = new PanDeCampoCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is PecosPulledPork)
                {
                    var ccc = new PecosPulledPorkCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is RustlersRibs)
                {
                    var ccc = new RustlersRibsCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is TexasTea)
                {
                    var ccc = new TexasTeaCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is TexasTripleBurger)
                {
                    var ccc = new TexasTripleCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is TrailBurger)
                {
                    var ccc = new TrailBurgerCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is Water)
                {
                    var ccc = new WaterCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
                else if (o is BakedBeans)
                {
                    var ccc = new BakedBeansCustomization();
                    ccc.DataContext = o;
                    orderControl.SwapScreen(ccc);
                }
            }
        }
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            IOrderItem lbi          = ((sender as ListBox).SelectedItem as IOrderItem);
            var        ordercontrol = this.FindAncestor <OrderControl>();

            if (lbi is AngryChicken)
            {
                var screen = new angryChickenCustomization();
                screen.DataContext = lbi;
                ordercontrol.SwapScreen(screen);
            }
            if (lbi is CowboyCoffee)
            {
                var screen = new CowboyCoffeeCustomization();
                screen.DataContext = lbi;
                ordercontrol.SwapScreen(screen);
            }
            if (lbi is CowpokeChili)
            {
                var screen = new CowpokechiliCustomization();
                screen.DataContext = lbi;
                ordercontrol.SwapScreen(screen);
            }
            if (lbi is DakotaDoubleBurger)
            {
                var screen = new DakotaDoubleBurgerCustomization();
                screen.DataContext = lbi;
                ordercontrol.SwapScreen(screen);
            }
            if (lbi is JerkedSoda)
            {
                var screen = new JerkedSodaCustomization();
                screen.DataContext = lbi;
                ordercontrol.SwapScreen(screen);
            }
            if (lbi is PecosPulledPork)
            {
                var screen = new PecosPulledPorkCustomization();
                screen.DataContext = lbi;
                ordercontrol.SwapScreen(screen);
            }
            if (lbi is TexasTea)
            {
                var screen = new TexasTeaCustomization();
                screen.DataContext = lbi;
                ordercontrol.SwapScreen(screen);
            }
            if (lbi is TexasTripleBurger)
            {
                var screen = new TexasTripleBurgerCustomization();
                screen.DataContext = lbi;
                ordercontrol.SwapScreen(screen);
            }
            if (lbi is TrailBurger)
            {
                var screen = new TrailBurgerCustomization();
                screen.DataContext = lbi;
                ordercontrol.SwapScreen(screen);
            }
            if (lbi is Water)
            {
                var screen = new WaterCustomization();
                screen.DataContext = lbi;
                ordercontrol.SwapScreen(screen);
            }
        }