Example #1
0
        /// <summary>
        /// Listener for the click event of the Rustler's Ribs Button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnAddRustlersRibsButton_Clicked(object sender, RoutedEventArgs e)
        {
            RustlersRibs r      = new RustlersRibs();
            var          screen = new CustomizeRustlersRibs();

            AddItemAndOpenCustomizationScreen(r, screen);
        }
        /// <summary>
        /// Click event to add Rustlers Ribs
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnAddRustlersRibsButtonClicked(Object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order data)
            {
                var entree = new RustlersRibs();
                var screen = new CustomizeRustlersRibs();
                AddItemAndOnCustomizationScreen(entree, screen);
            }
        }
 /// <summary>
 /// Event handler for adding the rustler's ribs entree to the order
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnAddRustlersRibsButtonClicked(object sender, RoutedEventArgs e)
 {
     if (DataContext is Order data)
     {
         var newRustlersRibs = new RustlersRibs();
         var screen          = new CustomizeRustlersRibs();
         screen.DataContext = newRustlersRibs;
         data.Add(newRustlersRibs);
         orderControl = this.FindAncestor <OrderControl>();
         orderControl.SwapScreen(screen);
     }
 }
Example #4
0
        /// <summary>
        /// The event handler for the rustler ribs
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AddToOrderRustlersRibs(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order data)
            {
                var entree = new RustlersRibs();
                var screen = new CustomizeRustlersRibs();
                screen.DataContext = entree;
                data.Add(new RustlersRibs());
                orderControl.SwapScreen(new CustomizeRustlersRibs());
            }
        }
        /// <summary>
        /// adds rustlers ribs to ordersummary control and order column on mainwindow
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnAddRustlersRibsButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            //orderControl.DataContext;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            default:
                screen = null;
                break;
            }

            //If screen was set to a value, go to that control
            if (screen != null)
            {
                screen.DataContext = item;
                SwapScreen(screen);
            }
        }
        /// <summary>
        /// Determines which menu item to add to order while also sending the user
        /// to the selection controls for each menu item
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    case "AngryChicken":
                        var entree = new AngryChicken();
                        var screen = new CustomizeAngryChicken();
                        AddItemAndOpenCustimizationScreen(entree, screen);
                        break;

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

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

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

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

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

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

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

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

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

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

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

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

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

                    case "Water":
                        var entree15 = new Water();
                        var screen15 = new CustomizeWater();
                        AddItemAndOpenCustimizationScreen(entree15, screen15);
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Allows the user to go back and change previously added items on the order
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="s"></param>
        void ChangeOrder(object sender, SelectionChangedEventArgs s)
        {
            var ancestor = this.FindAncestor <OrderControl>();

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

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


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

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

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

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

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

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

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

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

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

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

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


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

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

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

                    if (curItem.Contains("Water"))
                    {
                        var screen = new CustomizeWater();
                        ancestor.SwapScreen(screen);
                        screen.DataContext = OrderSumControlListView.SelectedItem;
                    }
                }
            }
        }
 /// <summary>
 /// Swaps to an instance of an order already created.
 /// </summary>
 /// <param name="sender">The user's interaction.</param>
 /// <param name="args">Argument data.</param>
 private void ItemSelectionChanged(object sender, RoutedEventArgs args)
 {
     if (DataContext is Order order)
     {
         if (sender is ListBox listBox)
         {
             var orderControl = this.FindAncestor <OrderControl>();
             if (listBox.SelectedItem is IOrderItem item)
             {
                 FrameworkElement screen = null;
                 if (item is AngryChicken)
                 {
                     screen             = new CustomizeAngryChicken();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is CowpokeChili)
                 {
                     screen             = new CustomizeCowpokeChili();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is DakotaDoubleBurger)
                 {
                     screen             = new CustomizeDakotaDoubleBurger();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is PecosPulledPork)
                 {
                     screen             = new CustomizePecosPulledPork();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is RustlersRibs)
                 {
                     screen             = new CustomizeRustlersRibs();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is TexasTripleBurger)
                 {
                     screen             = new CustomizeTexasTripleBurger();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is TrailBurger)
                 {
                     screen             = new CustomizeTrailBurger();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is BakedBeans)
                 {
                     screen             = new CustomizeBakedBeans();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is ChiliCheeseFries)
                 {
                     screen             = new CustomizeChiliCheeseFries();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is CornDodgers)
                 {
                     screen             = new CustomizeCornDodgers();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is PanDeCampo)
                 {
                     screen             = new CustomizePanDeCampo();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is CowboyCoffee)
                 {
                     screen             = new CustomizeCowboyCoffee();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is JerkedSoda)
                 {
                     screen             = new CustomizeJerkedSoda();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is TexasTea)
                 {
                     screen             = new CustomizeTexasTea();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
                 else if (item is Water)
                 {
                     screen             = new CustomizeWater();
                     screen.DataContext = item;
                     orderControl?.SwapScreen(screen);
                 }
             }
         }
     }
 }
        /// <summary>
        /// Updates the screen to the item selected customize screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    case "CowpokeChili":
                        var entree = new CowpokeChili();
                        var screen = new CustomizeCowpokeChili();
                        screen.DataContext = entree;
                        order.Add(entree);
                        orderControl.SwapScreen(screen);
                        break;

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

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

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

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

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

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

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

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

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

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

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

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

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

                    case "Water":
                        var entree15 = new Water();
                        var screen15 = new CustomizeWater();
                        screen15.DataContext = entree15;
                        order.Add(entree15);
                        orderControl.SwapScreen(screen15);
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Item seleceted event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ItemSelected(object sender, SelectionChangedEventArgs e)
        {
            IOrderItem p     = ((sender as ListBox).SelectedItem as IOrderItem);
            var        order = this.FindAncestor <OrderControl>();

            if (p is AngryChicken)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeAngryChicken();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is BakedBeans)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeBakedBeans();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is ChiliCheeseFries)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeChiliCheeseFries();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is CornDodgers)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeCornDodgers();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is CowboyCoffee)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeCowboyCoffee();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is CowpokeChili)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeCowpokeChili();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is DakotaDoubleBurger)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeDakotaDoubleBurger();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is JerkedSoda)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeJerkedSoda();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is PanDeCampo)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizePanDeCampo();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is PecosPulledPork)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizePecosPulledPork();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is RustlersRibs)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeRustlersRibs();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is TexasTea)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeTexasTea();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is TexasTripleBurger)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeTexasTripleBurger();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else if (p is TrailBurger)
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeTrailBurger();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
            else
            {
                if (DataContext is Order)
                {
                    var scr = new CustomizeWater();
                    scr.DataContext = p;
                    order.SwapScreen(scr);
                }
            }
        }
Example #14
0
        /// <summary>
        /// Swaps screen to the item clicked in the order summary control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OrderSummaryItemSelected(object sender, SelectionChangedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (orderControl == null)
            {
                return;
            }

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