/// <summary> /// Changes the flavor of the selected soda. /// </summary> /// <param name="button">Which flavor button was clicked</param> /// <param name="s">The soda we're dealing with here</param> private void ChangeFlavor(Button button, Sodasaurus s) { if (button.Name == App.ConvertToID(SodasaurusFlavor.Cola.ToString())) { s.Flavor = SodasaurusFlavor.Cola; } else if (button.Name == App.ConvertToID(SodasaurusFlavor.Orange.ToString())) { s.Flavor = SodasaurusFlavor.Orange; } else if (button.Name == App.ConvertToID(SodasaurusFlavor.Vanilla.ToString())) { s.Flavor = SodasaurusFlavor.Vanilla; } else if (button.Name == App.ConvertToID(SodasaurusFlavor.Chocolate.ToString())) { s.Flavor = SodasaurusFlavor.Chocolate; } else if (button.Name == App.ConvertToID(SodasaurusFlavor.RootBeer.ToString())) { s.Flavor = SodasaurusFlavor.RootBeer; } else if (button.Name == App.ConvertToID(SodasaurusFlavor.Cherry.ToString())) { s.Flavor = SodasaurusFlavor.Cherry; } else if (button.Name == App.ConvertToID(SodasaurusFlavor.Lime.ToString())) { s.Flavor = SodasaurusFlavor.Lime; } }
public FlavorSelection() { InitializeComponent(); int pos = 0; foreach (SodasaurusFlavor f in (SodasaurusFlavor[])System.Enum.GetValues(typeof(SodasaurusFlavor))) { Button button = new Button { Name = App.ConvertToID(f.ToString()), FontSize = 24, Content = new TextBlock { Text = f.ToString(), TextAlignment = TextAlignment.Center, TextWrapping = TextWrapping.WrapWithOverflow } }; button.SetValue(Grid.ColumnProperty, pos % 3); button.SetValue(Grid.RowProperty, pos / 3); button.Click += new RoutedEventHandler(ButtonOnClick); Flavors.Children.Add(button); pos++; } }
public EntreeSelection() { InitializeComponent(); int pos = 0; foreach (Entree entree in menu.AvailableEntrees) { Button button = new Button { Name = App.ConvertToID(entree.ToString()), FontSize = 24, Content = new TextBlock { Text = entree.ToString(), TextAlignment = TextAlignment.Center, TextWrapping = TextWrapping.WrapWithOverflow } }; button.SetValue(Grid.ColumnProperty, pos % 3); button.SetValue(Grid.RowProperty, pos / 3); button.Click += new RoutedEventHandler(ButtonOnClick); Entrees.Children.Add(button); pos++; } }
public SideSelection() { InitializeComponent(); int pos = 0; foreach (Side side in menu.AvailableSides) { Button button = new Button { Name = App.ConvertToID(side.ToString()), FontSize = 24, Content = new TextBlock { Text = side.ToString().Replace("Small ", ""), TextAlignment = TextAlignment.Center, TextWrapping = TextWrapping.WrapWithOverflow } }; button.SetValue(Grid.ColumnProperty, pos % 2); button.SetValue(Grid.RowProperty, pos / 2); button.Click += new RoutedEventHandler(ButtonOnClick); Sides.Children.Add(button); pos++; } Sizes.RowDefinitions.Add(new RowDefinition()); int pos2 = 0; foreach (DinoDiner.Menu.Size size in new DinoDiner.Menu.Size[] { DinoDiner.Menu.Size.Small, DinoDiner.Menu.Size.Medium, DinoDiner.Menu.Size.Large }) { RadioButton radioButton = new RadioButton { Name = size.ToString(), Content = size.ToString(), FontSize = 18, IsChecked = (size.ToString() == "Small") }; Sizes.ColumnDefinitions.Add(new ColumnDefinition()); radioButton.SetValue(Grid.ColumnProperty, pos2); radioButton.SetValue(Grid.RowProperty, 0); radioButton.Checked += RadioButtonOnClick; Sizes.Children.Add(radioButton); pos2++; } }
private void ButtonOnClick(object sender, RoutedEventArgs e) { if (sender is Button button && DataContext is Order order) { if (button.Name == App.ConvertToID(menu.AvailableEntrees[0].ToString())) { order.Items.Add(new Brontowurst()); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID(menu.AvailableEntrees[1].ToString())) { order.Items.Add(new DinoNuggets()); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID(menu.AvailableEntrees[2].ToString())) { order.Items.Add(new PrehistoricPBJ()); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID(menu.AvailableEntrees[3].ToString())) { order.Items.Add(new PterodactylWings()); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID(menu.AvailableEntrees[4].ToString())) { order.Items.Add(new SteakosaurusBurger()); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID(menu.AvailableEntrees[5].ToString())) { order.Items.Add(new TRexKingBurger()); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID(menu.AvailableEntrees[6].ToString())) { order.Items.Add(new VelociWrap()); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } if (!(CollectionViewSource.GetDefaultView(order.Items).CurrentItem is PterodactylWings)) { NavigationService?.Navigate(new CustomizeEntree()); } else { NavigationService?.Navigate(new MenuCategorySelection()); } } }
private void ButtonOnClick(object sender, RoutedEventArgs e) { if (sender is Button button && DataContext is Order order) { Drink drink; if (button.Name == App.ConvertToID(new JurassicJava().ToString())) { drink = new JurassicJava(); SelectingJurassicJava(); } else if (button.Name == App.ConvertToID(new Sodasaurus().ToString())) { drink = new Sodasaurus(); SelectingSodasaurus(); } else if (button.Name == App.ConvertToID(new Tyrannotea().ToString())) { drink = new Tyrannotea(); SelectingTyrannotea(); } else { drink = new Water(); SelectingWater(); } if ((bool)(Sizes.Children[1] as RadioButton).IsChecked) { drink.Size = DinoDiner.Menu.Size.Medium; } else if ((bool)(Sizes.Children[2] as RadioButton).IsChecked) { drink.Size = DinoDiner.Menu.Size.Large; } if (wasCombo && CollectionViewSource.GetDefaultView(order.Items).CurrentItem is CretaceousCombo combo) { combo.Drink = drink; } else { order.Items.Add(drink); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } } }
private void ButtonOnClick(object sender, RoutedEventArgs e) { if (sender is Button button && DataContext is Order order) { Side side; if (button.Name == App.ConvertToID(menu.AvailableSides[0].ToString())) { side = new Fryceritops(); } else if (button.Name == App.ConvertToID(menu.AvailableSides[1].ToString())) { side = new MeteorMacAndCheese(); } else if (button.Name == App.ConvertToID(menu.AvailableSides[2].ToString())) { side = new MezzorellaSticks(); } else if (button.Name == App.ConvertToID(menu.AvailableSides[3].ToString())) { side = new Triceritots(); } else { side = new Fryceritops(); } if ((bool)(Sizes.Children[1] as RadioButton).IsChecked) { side.Size = DinoDiner.Menu.Size.Medium; } else if ((bool)(Sizes.Children[2] as RadioButton).IsChecked) { side.Size = DinoDiner.Menu.Size.Large; } if (wasCombo && CollectionViewSource.GetDefaultView(order.Items).CurrentItem is CretaceousCombo combo) { combo.Side = side; } else { order.Items.Add(side); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } } }
private void ButtonOnClick(object sender, RoutedEventArgs e) { if (sender is Button button && DataContext is Order order) { if (button.Name == App.ConvertToID((new Brontowurst().ToString()))) { order.Items.Add(new CretaceousCombo(new Brontowurst())); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID((new DinoNuggets().ToString()))) { order.Items.Add(new CretaceousCombo(new DinoNuggets())); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID((new PrehistoricPBJ().ToString()))) { order.Items.Add(new CretaceousCombo(new PrehistoricPBJ())); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID((new PterodactylWings().ToString()))) { order.Items.Add(new CretaceousCombo(new PterodactylWings())); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID((new SteakosaurusBurger().ToString()))) { order.Items.Add(new CretaceousCombo(new SteakosaurusBurger())); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID((new TRexKingBurger().ToString()))) { order.Items.Add(new CretaceousCombo(new TRexKingBurger())); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } else if (button.Name == App.ConvertToID((new VelociWrap().ToString()))) { order.Items.Add(new CretaceousCombo(new VelociWrap())); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } if (CollectionViewSource.GetDefaultView(order.Items).CurrentItem is CretaceousCombo combo && combo.Entree is PterodactylWings) { NavigationService?.Navigate(new CustomizeCombo()); }