Skip to content

Commit c566a34

Browse files
committed
POS ksu-cis#2 progress
1 parent 9b4ce6c commit c566a34

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

Data/Drinks/AretinoAppleJuice.cs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Runtime.CompilerServices;
35
using System.Text;
46
using BleakwindBuffet.Data.Enums;
57

@@ -11,9 +13,20 @@
1113
namespace BleakwindBuffet.Data.Drinks
1214
{
1315

14-
public class AretinoAppleJuice : Drink, IOrderItem
16+
public class AretinoAppleJuice : Drink, IOrderItem, INotifyPropertyChanged
17+
18+
1519
{
20+
/// <summary>
21+
///
22+
/// </summary>
23+
public event PropertyChangedEventHandler PropertyChanged;
24+
1625

26+
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "" )
27+
{
28+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
29+
}
1730
/// <summary>
1831
/// Gets the price of the juice
1932
/// </summary>
@@ -72,8 +85,23 @@ public override uint Calories
7285
/// <summary>
7386
/// Gets whether or not to add ice
7487
/// </summary>
75-
public bool Ice { get; set; } = false;
88+
public bool Ice
89+
{
90+
get
91+
{
92+
return this.ice;
93+
}
94+
set
95+
{
96+
if (value != this.ice)
97+
{
98+
this.ice = value;
99+
NotifyPropertyChanged();
100+
}
101+
}
102+
}
76103

104+
private bool ice = false;
77105
/// <summary>
78106
/// Allows customization on the juice
79107
/// </summary>

DataTests/UnitTests/DrinkTests/AretinoAppleJuiceTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ namespace BleakwindBuffet.DataTests.UnitTests.DrinkTests
1414
{
1515
public class AretinoAppleJuiceTests
1616
{
17+
[Fact]
18+
public void ChangingIceNotifiesIceProperty()
19+
{
20+
var AJ = new AretinoAppleJuice();
21+
22+
Assert.PropertyChanged(AJ, "Ice", () => AJ.Ice = true);
23+
}
1724
[Fact]
1825
public void ShouldBeADrink()
1926
{

PointOfSale/DrinkList.xaml.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using PointOfSale.DrinkCustomization;
1+
using BleakwindBuffet.Data.Drinks;
2+
using PointOfSale.DrinkCustomization;
23
using System;
34
using System.Collections.Generic;
45
using System.Text;
@@ -59,7 +60,10 @@ private void MarkarthMilk_Click(object sender, RoutedEventArgs e)
5960
/// <param name="e">button pressed</param>
6061
private void AretinoAppleJuice_Click(object sender, RoutedEventArgs e)
6162
{
63+
var Aj = new AretinoAppleJuice();
64+
6265
this.NavigationService.Navigate(new AretinoApple_Juice());
66+
6367
}
6468

6569
/// <summary>

PointOfSale/MainWindow.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
<Grid>
1010
<Border BorderThickness="1" BorderBrush="Black" Margin="0,0,600,0" Background="#FF1E3BD4"/>
1111
<Image HorizontalAlignment="Left" Height="100" Margin="454,190,0,0" VerticalAlignment="Top" Width="100"/>
12-
<Border BorderThickness="1" BorderBrush="Black" Margin="650,0,0,0" Background="#FFE73D28">
12+
<Border BorderThickness="1" BorderBrush="Black" Margin="635,0,0,0" Background="#FFE73D28">
1313
<TextBox Text="Order Details" TextWrapping="Wrap" Margin="29,9,29,639" RenderTransformOrigin="0.551,0.783"/>
1414
</Border>
1515
<Button Content="Drinks" HorizontalAlignment="Left" Margin="40,140,0,0" VerticalAlignment="Top" Height="66" Width="120" Click="Button_Click"/>
1616
<Button x:Name="Entrees" Content="Entrees" HorizontalAlignment="Left" Margin="40,233,0,0" VerticalAlignment="Top" Height="66" Width="120" Click="EntreesClick"/>
1717
<Button Content="Sides" HorizontalAlignment="Left" Margin="40,342,0,0" VerticalAlignment="Top" Height="66" Width="120" Click="Button_Click_1"/>
1818
<Image Margin="44,26,644,567" Stretch="Fill" Source="pack://siteoforigin:,,,/buffet.jpg"/>
19-
<Frame x:Name="frame" Content="" Width="450" Margin="200,-13,150,-3" NavigationUIVisibility="Hidden" />
19+
<Frame x:Name="frame" Content="" Margin="200,-13,165,-3" NavigationUIVisibility="Hidden" />
20+
<Button Content="Finish" HorizontalAlignment="Left" Margin="658,574,0,0" VerticalAlignment="Top" Height="66" Width="120" Click="Button_Click"/>
21+
<Button Content="Cancel Order" HorizontalAlignment="Left" Margin="658,479,0,0" VerticalAlignment="Top" Height="66" Width="120" Click="Button_Click"/>
2022

2123

2224
</Grid>

0 commit comments

Comments
 (0)