Skip to content

Commit

Permalink
In progress of dynamically adding and removing buttons for DrinkSelec…
Browse files Browse the repository at this point in the history
…tion page.
  • Loading branch information
RobertOstermann committed Oct 13, 2019
1 parent 6c3fd65 commit 75c5719
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 8 deletions.
31 changes: 23 additions & 8 deletions PointOfSale/DrinkSelection.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,32 @@
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Style="{StaticResource SimpleButton}" Grid.Row="0">
<Button Style="{StaticResource SimpleButton}" Grid.Row="0"
Name="SodasaurusButton" Click="SelectSodasaurus">
<Button.Background>
<ImageBrush ImageSource="Assets/DinoDiner-14.png" Opacity="0.25"/>
</Button.Background>
<TextBlock Style="{StaticResource SimpleTextBlock}">
Sodasaurus
</TextBlock>
</Button>
<Button Style="{StaticResource SimpleButton}" Grid.Row="1">
<Button Style="{StaticResource SimpleButton}" Grid.Row="1" Name="TyrannoteaButton">
<Button.Background>
<ImageBrush ImageSource="Assets/DinoDiner-13.png" Opacity="0.25"/>
</Button.Background>
<TextBlock Style="{StaticResource SimpleTextBlock}">
Tyrannotea
</TextBlock>
</Button>
<Button Style="{StaticResource SimpleButton}" Grid.Row="2">
<Button Style="{StaticResource SimpleButton}" Grid.Row="2" Name="JurassicJavaButton">
<Button.Background>
<ImageBrush ImageSource="Assets/DinoDiner-12.png" Opacity="0.25"/>
</Button.Background>
<TextBlock Style="{StaticResource SimpleTextBlock}">
Jurrasic Java
</TextBlock>
</Button>
<Button Style="{StaticResource SimpleButton}" Grid.Row="3">
<Button Style="{StaticResource SimpleButton}" Grid.Row="3" Name="WaterButton">
<Button.Background>
<ImageBrush ImageSource="Assets/DinoDiner-15.png" Opacity="0.25"/>
</Button.Background>
Expand Down Expand Up @@ -100,14 +101,28 @@
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Style="{StaticResource SimpleButton}" Grid.Row="0" Click="SelectFlavor">
<Button Style="{StaticResource SimpleButton}" Grid.Row="0"
Name="SelectFlavorButton" Click="SelectFlavor">
<TextBlock Style="{StaticResource SimpleTextBlock}">
Flavor
</TextBlock>
</Button>
<Button Style="{StaticResource SimpleButton}" Grid.Row="0"
Name="SelectDecafButton" Click="SelectDecaf">
<TextBlock Style="{StaticResource SimpleTextBlock}">
TODO: Dynamic Add Sweet/Decaf/Flavor
Decaf
</TextBlock>
</Button>
<Button Style="{StaticResource SimpleButton}" Grid.Row="1">
<Button Style="{StaticResource SimpleButton}" Grid.Row="0"
Name="SelectSweetButton" Click="SelectSweet">
<TextBlock Style="{StaticResource SimpleTextBlock}">
Sweet
</TextBlock>
</Button>
<Button Style="{StaticResource SimpleButton}" Grid.Row="1"
Name="AddLemonButton">
<TextBlock Style="{StaticResource SimpleTextBlock}">
TODO: Dynamic Add Lemon
Add Lemon
</TextBlock>
</Button>
<Button Style="{StaticResource SimpleButton}" Grid.Row="2">
Expand Down
59 changes: 59 additions & 0 deletions PointOfSale/DrinkSelection.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,46 @@ public DrinkSelection()
InitializeComponent();
Drink = new Water();
SmallButton.Background = Brushes.LightGreen;
SelectSweetButton.IsEnabled = false;
SelectSweetButton.Visibility = Visibility.Hidden;
SelectDecafButton.IsEnabled = false;
SelectDecafButton.Visibility = Visibility.Hidden;
SelectFlavorButton.IsEnabled = false;
SelectFlavorButton.Visibility = Visibility.Hidden;
WaterButton.BorderBrush = Brushes.LightGreen;
WaterButton.BorderThickness = new Thickness(2.5);
//WaterButton.ClearValue(Control.BorderBrushProperty);
//WaterButton.ClearValue(Control.BorderThicknessProperty);
}

/// <summary>
/// Sets the drink to sodasaurus.
/// Enables the flavor button.
/// Disables the lemon button.
/// </summary>
/// <param name="obj"></param>
/// <param name="args"></param>
private void SelectSodasaurus(object obj, RoutedEventArgs args)
{
Drink = new Sodasaurus();
SmallButton.Background = Brushes.LightGreen;
MediumButton.ClearValue(Control.BackgroundProperty);
LargeButton.ClearValue(Control.BackgroundProperty);
SelectSweetButton.IsEnabled = false;
SelectSweetButton.Visibility = Visibility.Hidden;
SelectDecafButton.IsEnabled = false;
SelectDecafButton.Visibility = Visibility.Hidden;
SelectFlavorButton.IsEnabled = true;
SelectFlavorButton.Visibility = Visibility.Visible;
SodasaurusButton.BorderBrush = Brushes.LightGreen;
SodasaurusButton.BorderThickness = new Thickness(2.5);

TyrannoteaButton.ClearValue(Control.BorderBrushProperty);
TyrannoteaButton.ClearValue(Control.BorderThicknessProperty);
JurassicJavaButton.ClearValue(Control.BorderBrushProperty);
JurassicJavaButton.ClearValue(Control.BorderThicknessProperty);
WaterButton.ClearValue(Control.BorderBrushProperty);
WaterButton.ClearValue(Control.BorderThicknessProperty);
}

/// <summary>
Expand All @@ -45,6 +85,25 @@ private void SelectFlavor(object obj, RoutedEventArgs args)
{
NavigationService.Navigate(new FlavorSelection());
}
/// <summary>
/// Adds or removes sweet.
/// </summary>
/// <param name="obj"></param>
/// <param name="args"></param>
private void SelectSweet(object obj, RoutedEventArgs args)
{

}

/// <summary>
/// Determines wheter the Tyrannotea is decaf.
/// </summary>
/// <param name="obj"></param>
/// <param name="args"></param>
private void SelectDecaf(object obj, RoutedEventArgs args)
{

}

/// <summary>
/// Sets the size of the combo to small.
Expand Down

0 comments on commit 75c5719

Please sign in to comment.