/// <summary>
        /// This method adds sides 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 addSideToList(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 "BakedBeansButton":
                        item = new BakedBeans();
                        break;

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

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

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

                    default:
                        throw new NotImplementedException("Unknown side button clicked");
                    }
                    screen             = new SideSizeCustomization(DataContext);
                    screen.DataContext = item;
                    data.Add(item);
                    orderControl?.SwapScreen(screen);
                }
            }
        }
Beispiel #2
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);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// allows existing order list items to be reopened to edit its properties
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OrderListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (OrderListView.SelectedItem == null)
            {
                return;
            }

            if (sender is ListBox list)
            {
                if (list.SelectedItem is IOrderItem item)
                {
                    list.SelectedItem = null;
                    if (item is AngryChicken ac)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new AngryChickenCustomization(DataContext);
                        screen.DataContext = ac;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is CowpokeChili cpc)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new CowpokeChiliCustomization(DataContext);
                        screen.DataContext = cpc;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is DakotaDoubleBurger ddb)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new DakotaDoubleCustomization(DataContext);
                        screen.DataContext = ddb;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is PecosPulledPork ppp)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new PecosPulledPorkCustomization(DataContext);
                        screen.DataContext = ppp;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is RustlersRibs rr)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new RustlersRibsCustomization();
                        screen.DataContext = rr;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is TexasTripleBurger ttb)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new TexasTripleCustomization(DataContext);
                        screen.DataContext = ttb;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is TrailBurger tb)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new TrailBurgerCustomization(DataContext);
                        screen.DataContext = tb;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is CowboyCoffee cc)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new CowboyCoffeeCustomization(DataContext);
                        screen.DataContext = cc;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is JerkedSoda js)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new JerkedSodaCustomization(DataContext);
                        screen.DataContext = js;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is TexasTea tt)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new TexasTeaCustomization(DataContext);
                        screen.DataContext = tt;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is Water w)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new WaterCustomization(DataContext);
                        screen.DataContext = w;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is BakedBeans bb)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new SideSizeCustomization(DataContext);
                        screen.DataContext = bb;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is ChiliCheeseFries ccf)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new SideSizeCustomization(DataContext);
                        screen.DataContext = ccf;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is CornDodgers cd)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new SideSizeCustomization(DataContext);
                        screen.DataContext = cd;
                        orderControl?.SwapScreen(screen);
                    }
                    if (item is PanDeCampo pdc)
                    {
                        var orderControl = this.FindAncestor <OrderControl>();
                        var screen       = new SideSizeCustomization(DataContext);
                        screen.DataContext = pdc;
                        orderControl?.SwapScreen(screen);
                    }
                }
            }
        }