Skip to content

Commit

Permalink
Point of Sale Milestone 2
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertOstermann committed Oct 27, 2019
1 parent 7e03cb5 commit 8ba6fb2
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 51 deletions.
34 changes: 20 additions & 14 deletions PointOfSale/CustomizeCombo.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace PointOfSale
/// </summary>
public partial class CustomizeCombo : Page
{
public CretaceousCombo Combo { get; private set; }
private CretaceousCombo combo;

/// <summary>
/// Initialize the CustomizeCombo page.
Expand All @@ -34,9 +34,9 @@ public partial class CustomizeCombo : Page
public CustomizeCombo(Entree entree)
{
InitializeComponent();
Combo = new CretaceousCombo(entree);
DrinkChoice.Text = Combo.Drink.ToString();
SideChoice.Text = Combo.Side.ToString();
combo = new CretaceousCombo(entree);
DrinkChoice.Text = combo.Drink.ToString();
SideChoice.Text = combo.Side.ToString();
}

/// <summary>
Expand All @@ -46,7 +46,7 @@ public CustomizeCombo(Entree entree)
/// <param name="args"></param>
private void SelectSide(object sender, RoutedEventArgs args)
{
NavigationService.Navigate(new SideSelection());
NavigationService.Navigate(new SideSelection(combo.Side));
}

/// <summary>
Expand All @@ -56,7 +56,7 @@ private void SelectSide(object sender, RoutedEventArgs args)
/// <param name="args"></param>
private void SelectDrink(object sender, RoutedEventArgs args)
{
NavigationService.Navigate(new DrinkSelection());
NavigationService.Navigate(new DrinkSelection(combo.Drink));
}

/// <summary>
Expand All @@ -66,10 +66,9 @@ private void SelectDrink(object sender, RoutedEventArgs args)
/// <param name="args"></param>
private void SelectSmall(object sender, RoutedEventArgs args)
{
Combo.Size = DinoDiner.Menu.Size.Small;
ClearButtonValues();
combo.Size = DinoDiner.Menu.Size.Small;
SmallButton.Background = Brushes.LightGreen;
MediumButton.ClearValue(Control.BackgroundProperty);
LargeButton.ClearValue(Control.BackgroundProperty);
}

/// <summary>
Expand All @@ -79,10 +78,9 @@ private void SelectSmall(object sender, RoutedEventArgs args)
/// <param name="args"></param>
private void SelectMedium(object sender, RoutedEventArgs args)
{
Combo.Size = DinoDiner.Menu.Size.Medium;
SmallButton.ClearValue(Control.BackgroundProperty);
ClearButtonValues();
combo.Size = DinoDiner.Menu.Size.Medium;
MediumButton.Background = Brushes.LightGreen;
LargeButton.ClearValue(Control.BackgroundProperty);
}

/// <summary>
Expand All @@ -92,10 +90,18 @@ private void SelectMedium(object sender, RoutedEventArgs args)
/// <param name="args"></param>
private void SelectLarge(object sender, RoutedEventArgs args)
{
Combo.Size = DinoDiner.Menu.Size.Large;
ClearButtonValues();
combo.Size = DinoDiner.Menu.Size.Large;
LargeButton.Background = Brushes.LightGreen;
}
/// <summary>
/// Resets the button values.
/// </summary>
private void ClearButtonValues()
{
SmallButton.ClearValue(Control.BackgroundProperty);
MediumButton.ClearValue(Control.BackgroundProperty);
LargeButton.Background = Brushes.LightGreen;
LargeButton.ClearValue(Control.BackgroundProperty);
}
}
}
20 changes: 5 additions & 15 deletions PointOfSale/DrinkSelection.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public DrinkSelection()
}
/// <summary>
/// Initializes the DrinkSelection page.
/// Allows for a drink to be passed in.
/// </summary>
/// <param name="currentDrink"></param>
public DrinkSelection(Drink currentDrink)
Expand Down Expand Up @@ -77,8 +76,6 @@ private void SelectCancel(object sender, RoutedEventArgs args)
}
/// <summary>
/// Sets the drink to Water.
/// Disables Decaf/Sweet/Flavor buttons.
/// Enables the lemon button.
/// </summary>
/// <param name="obj"></param>
/// <param name="args"></param>
Expand All @@ -92,8 +89,6 @@ private void SelectWater(object sender, RoutedEventArgs args)
}
/// <summary>
/// Sets the drink to sodasaurus.
/// Enables the flavor button.
/// Disables the lemon button.
/// </summary>
/// <param name="obj"></param>
/// <param name="args"></param>
Expand All @@ -108,8 +103,6 @@ private void SelectSodasaurus(object sender, RoutedEventArgs args)

/// <summary>
/// Sets the drink to tyrannotea.
/// Enables the sweet button.
/// Enables the lemon button.
/// </summary>
/// <param name="obj"></param>
/// <param name="args"></param>
Expand All @@ -124,8 +117,6 @@ private void SelectTyrannotea(object sender, RoutedEventArgs args)

/// <summary>
/// Sets the drink to Jurrasic Java.
/// Enables the Decaf button.
/// Disables the lemon button.
/// </summary>
/// <param name="obj"></param>
/// <param name="args"></param>
Expand All @@ -150,14 +141,13 @@ private void SelectFlavor(object sender, RoutedEventArgs args)
}
}
/// <summary>
/// Adds or removes sweet.
/// Determines whether the tea is sweet.
/// </summary>
/// <param name="obj"></param>
/// <param name="args"></param>
private void SelectSweet(object sender, RoutedEventArgs args)
{
Tyrannotea tea = drink as Tyrannotea;
if (tea != null)
if (drink is Tyrannotea tea)
{
if (tea.Sweet)
{
Expand Down Expand Up @@ -307,7 +297,7 @@ private void SelectLarge(object sender, RoutedEventArgs args)
LargeButton.Background = buttonColor;
}
/// <summary>
/// Sets the correct button properties and visibilities.
/// Prepares the DrinkSelection user interface.
/// </summary>
private void SetUpDrinkSelection()
{
Expand Down Expand Up @@ -386,7 +376,7 @@ private void SetUpDrinkSelection()
}
}
/// <summary>
/// Clears the border values of all buttons.
/// Resets the button values.
/// </summary>
private void ClearButtonValues()
{
Expand All @@ -411,7 +401,7 @@ private void ClearButtonValues()
IceButton.ClearValue(Control.BackgroundProperty);
}
/// <summary>
/// Disables property buttons.
/// Hides and disables property buttons.
/// Enables size buttons.
/// </summary>
private void HideAndDisableAndEnableButtons()
Expand Down
26 changes: 16 additions & 10 deletions PointOfSale/EntreeSelection.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public partial class EntreeSelection : Page
private Brush buttonColor = Brushes.LightGreen;

private Thickness buttonBorderThickness = new Thickness(2.5);

/// <summary>
/// Initialize the EntreeSelection page.
/// </summary>
public EntreeSelection()
{
InitializeComponent();
Expand Down Expand Up @@ -60,7 +62,7 @@ private void SelectCancel(object sender, RoutedEventArgs args)
NavigationService.Navigate(new MenuCategorySelection());
}
/// <summary>
/// Selects the brontowurst as the entree.
/// Selects brontowurst as the entree.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -71,7 +73,7 @@ private void SelectBrontowurst(object sender, RoutedEventArgs args)
}

/// <summary>
/// Selects the brontowurst as the entree.
/// Selects dino-nuggets as the entree.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -82,7 +84,7 @@ private void SelectDinoNuggets(object sender, RoutedEventArgs args)
}

/// <summary>
/// Selects the brontowurst as the entree.
/// Selects prehistoric pb&j as the entree.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -93,7 +95,7 @@ private void SelectPrehistoricPBJ(object sender, RoutedEventArgs args)
}

/// <summary>
/// Selects the brontowurst as the entree.
/// Selects pterodactyl wings as the entree.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -104,7 +106,7 @@ private void SelectPterodactylWings(object sender, RoutedEventArgs args)
}

/// <summary>
/// Selects the brontowurst as the entree.
/// Selects steakosaurus burger as the entree.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -115,7 +117,7 @@ private void SelectSteakosaurusBurger(object sender, RoutedEventArgs args)
}

/// <summary>
/// Selects the brontowurst as the entree.
/// Selects trex kingburger as the entree.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -126,7 +128,7 @@ private void SelectTRexKingburger(object sender, RoutedEventArgs args)
}

/// <summary>
/// Selects the brontowurst as the entree.
/// Selects veloci wrap as the entree.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -135,7 +137,9 @@ private void SelectVelociWrap(object sender, RoutedEventArgs args)
entree = new VelociWrap();
SetUpEntreeSelection();
}

/// <summary>
/// Prepares the EntreeSelection user interface.
/// </summary>
private void SetUpEntreeSelection()
{
ClearButtonValues();
Expand Down Expand Up @@ -182,7 +186,9 @@ private void SetUpEntreeSelection()
VelociWrapButton.BorderThickness = buttonBorderThickness;
}
}

/// <summary>
/// Resets the button values.
/// </summary>
private void ClearButtonValues()
{
BrontowurstButton.ClearValue(Control.BorderBrushProperty);
Expand Down
16 changes: 6 additions & 10 deletions PointOfSale/FlavorSelection.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public partial class FlavorSelection : Page
private SodasaurusFlavor flavor;

private Brush buttonColor = Brushes.LightGreen;

/// <summary>
/// Initialize the FlavorSelection page.
/// </summary>
/// <param name="drink"></param>
public FlavorSelection(Sodasaurus drink)
{
InitializeComponent();
Expand Down Expand Up @@ -61,7 +64,6 @@ private void SelectCancel(object sender, RoutedEventArgs args)
}
/// <summary>
/// Sets the flavor to cherry.
/// Alters the user interface accordingly.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -73,7 +75,6 @@ private void SelectCherry(object sender, RoutedEventArgs args)
}
/// <summary>
/// Sets the flavor to chocolate.
/// Alters the user interface accordingly.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -85,7 +86,6 @@ private void SelectChocolate(object sender, RoutedEventArgs args)
}
/// <summary>
/// Sets the flavor to cola.
/// Alters the user interface accordingly.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -97,7 +97,6 @@ private void SelectCola(object sender, RoutedEventArgs args)
}
/// <summary>
/// Sets the flavor to lime.
/// Alters the user interface accordingly.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -109,7 +108,6 @@ private void SelectLime(object sender, RoutedEventArgs args)
}
/// <summary>
/// Sets the flavor to orange.
/// Alters the user interface accordingly.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -121,7 +119,6 @@ private void SelectOrange(object sender, RoutedEventArgs args)
}
/// <summary>
/// Sets the flavor to root beer.
/// Alters the user interface accordingly.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -133,7 +130,6 @@ private void SelectRootBeer(object sender, RoutedEventArgs args)
}
/// <summary>
/// Sets the flavor to cherry.
/// Alters the user interface accordingly.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
Expand All @@ -144,7 +140,7 @@ private void SelectVanilla(object sender, RoutedEventArgs args)
flavor = SodasaurusFlavor.Vanilla;
}
/// <summary>
/// Sets the correct flavor button.
/// Prepares the FlavorSelection user interface.
/// </summary>
private void SetUpFlavorSelection()
{
Expand All @@ -158,7 +154,7 @@ private void SetUpFlavorSelection()
if (flavor == SodasaurusFlavor.Vanilla) VanillaButton.Background = buttonColor;
}
/// <summary>
/// Clears the background property of all buttons.
/// Resets the button values.
/// </summary>
private void ClearButtonValues()
{
Expand Down
19 changes: 17 additions & 2 deletions PointOfSale/SideSelection.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ public SideSelection()
InitializeComponent();
DisableButtons();
}
/// <summary>
/// Initialize the SideSelection page.
/// </summary>
/// <param name="currentSide"></param>
public SideSelection(Side currentSide)
{
InitializeComponent();
DisableButtons();
side = currentSide;
SetUpSideSelection();
}

/// <summary>
/// Adds the entree to the order.
Expand Down Expand Up @@ -148,7 +159,9 @@ private void SelectLarge(object sender, RoutedEventArgs args)
MediumButton.ClearValue(Control.BackgroundProperty);
LargeButton.Background = Brushes.LightGreen;
}

/// <summary>
/// Prepares the SideSelection user interface.
/// </summary>
private void SetUpSideSelection()
{
ClearButtonValues();
Expand Down Expand Up @@ -185,7 +198,9 @@ private void SetUpSideSelection()
TriceritotsButton.BorderThickness = buttonBorderThickness;
}
}

/// <summary>
/// Resets the button values.
/// </summary>
private void ClearButtonValues()
{
FryceritopsButton.ClearValue(Control.BorderBrushProperty);
Expand Down

0 comments on commit 8ba6fb2

Please sign in to comment.