Skip to content

Commit e5e9c07

Browse files
committed
Done with POS Milestone ksu-cis#2 Code
1 parent a037959 commit e5e9c07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1246
-51
lines changed

Data/Drinks/AretinoAppleJuice.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,17 @@ public class AretinoAppleJuice : Drink
3636
/// <summary>
3737
/// The size of the Aretino Apple Juice
3838
/// </summary>
39-
public override Size Size { get => size; set => size = value; }
39+
public override Size Size {
40+
get => size;
41+
set {
42+
size = value;
43+
OnPropertyChanged("Calories");
44+
OnPropertyChanged("Price");
45+
OnPropertyChanged("Size");
46+
}
47+
}
4048

41-
private List<string> specialInstructions = new List<string>();
49+
private List<string> specialInstructions = new List<string>();
4250
/// <summary>
4351
/// A list of special instructions for preparing the Aretino Apple Juice
4452
/// </summary>
@@ -62,6 +70,7 @@ public override bool Ice {
6270
if (value == Ice) return;
6371
if (value) specialInstructions.Add(possibleInstructions[0]);
6472
else specialInstructions.Remove(possibleInstructions[0]);
73+
OnPropertyChanged("Ice");
6574
}
6675
}
6776

Data/Drinks/CandlehearthCoffee.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,17 @@ public class CandlehearthCoffee : Drink
3737
/// <summary>
3838
/// The size of the Candlehearth Coffee
3939
/// </summary>
40-
public override Size Size { get => size; set => size = value; }
40+
public override Size Size {
41+
get => size;
42+
set {
43+
size = value;
44+
OnPropertyChanged("Calories");
45+
OnPropertyChanged("Price");
46+
OnPropertyChanged("Size");
47+
}
48+
}
4149

42-
private List<string> specialInstructions = new List<string>();
50+
private List<string> specialInstructions = new List<string>();
4351
/// <summary>
4452
/// A list of special instructions for preparing the Candlehearth Coffee
4553
/// </summary>
@@ -62,6 +70,7 @@ public override bool Ice {
6270
if (value == Ice) return;
6371
if (value) specialInstructions.Add(possibleInstructions[0]);
6472
else specialInstructions.Remove(possibleInstructions[0]);
73+
OnPropertyChanged("Ice");
6574
}
6675
}
6776

@@ -76,13 +85,21 @@ public bool RoomForCream {
7685
if (value == RoomForCream) return;
7786
if (value) specialInstructions.Add(possibleInstructions[1]);
7887
else specialInstructions.Remove(possibleInstructions[1]);
88+
OnPropertyChanged("RoomForCream");
7989
}
8090
}
8191

92+
private bool decaf = false;
8293
/// <summary>
8394
/// If the Candlehearth Coffee is decaf
8495
/// </summary>
85-
public bool Decaf { get; set; }
96+
public bool Decaf {
97+
get { return decaf; }
98+
set {
99+
decaf = value;
100+
OnPropertyChanged("Decaf");
101+
}
102+
}
86103

87104
/// <summary>
88105
/// Returns a description of the Candlehearth Coffee

Data/Drinks/Drink.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Text;
4+
using System.ComponentModel;
45

56
/*
67
* Author: Riley Mueller
@@ -12,7 +13,7 @@ namespace BleakwindBuffet.Data.Drinks
1213
/// <summary>
1314
/// Class for representing a general drink
1415
/// </summary>
15-
public abstract class Drink : IOrderItem
16+
public abstract class Drink : IOrderItem, INotifyPropertyChanged
1617
{
1718
/// <summary>
1819
/// The display name of the drink
@@ -39,6 +40,20 @@ public abstract class Drink : IOrderItem
3940
/// </summary>
4041
public abstract bool Ice { get; set; }
4142

43+
/// <summary>
44+
/// Event invoked when a property is changed
45+
/// </summary>
46+
public event PropertyChangedEventHandler PropertyChanged;
47+
48+
/// <summary>
49+
/// Wrapper method so that child classes may invoke PropertyChanged
50+
/// </summary>
51+
/// <param name="propertyName">String representing the property name</param>
52+
protected virtual void OnPropertyChanged(string propertyName)
53+
{
54+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
55+
}
56+
4257
/// <summary>
4358
/// Returns a description of the drink
4459
/// </summary>

Data/Drinks/MarkarthMilk.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ public class MarkarthMilk : Drink
3636
/// <summary>
3737
/// The size of the Markarth Milk
3838
/// </summary>
39-
public override Size Size { get => size; set => size = value; }
39+
public override Size Size {
40+
get => size;
41+
set {
42+
size = value;
43+
OnPropertyChanged("Calories");
44+
OnPropertyChanged("Price");
45+
OnPropertyChanged("Size");
46+
}
47+
}
4048

4149
private List<string> specialInstructions = new List<string>();
4250
/// <summary>
@@ -61,6 +69,7 @@ public override bool Ice {
6169
if (value == Ice) return;
6270
if (value) specialInstructions.Add(possibleInstructions[0]);
6371
else specialInstructions.Remove(possibleInstructions[0]);
72+
OnPropertyChanged("Ice");
6473
}
6574
}
6675
/// <summary>

Data/Drinks/SailorSoda.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,26 @@ public class SailorSoda : Drink
3636
/// <summary>
3737
/// The size of the Sailor Soda
3838
/// </summary>
39-
public override Size Size { get => size; set => size = value; }
39+
public override Size Size {
40+
get => size;
41+
set {
42+
size = value;
43+
OnPropertyChanged("Calories");
44+
OnPropertyChanged("Price");
45+
OnPropertyChanged("Size");
46+
}
47+
}
4048

4149
private SodaFlavor flavor = SodaFlavor.Cherry;
4250
/// <summary>
4351
/// The flavor of the Sailor Soda
4452
/// </summary>
45-
public SodaFlavor Flavor { get => flavor; set => flavor = value; }
53+
public SodaFlavor Flavor { get => flavor;
54+
set {
55+
flavor = value;
56+
OnPropertyChanged("Flavor");
57+
}
58+
}
4659

4760
private List<string> specialInstructions = new List<string>();
4861
/// <summary>
@@ -65,6 +78,7 @@ public override bool Ice {
6578
if (value == Ice) return;
6679
if (!value) specialInstructions.Add(possibleInstructions[0]);
6780
else specialInstructions.Remove(possibleInstructions[0]);
81+
OnPropertyChanged("Ice");
6882
}
6983
}
7084
/// <summary>

Data/Drinks/WarriorWater.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System;
33
using System.Collections.Generic;
44
using System.Text;
5+
using System.ComponentModel;
56

67
/*
78
* Author: Riley Mueller
@@ -36,7 +37,15 @@ public class WarriorWater : Drink
3637
/// <summary>
3738
/// The size of the Warrior Water
3839
/// </summary>
39-
public override Size Size { get => size; set => size = value; }
40+
public override Size Size {
41+
get => size;
42+
set {
43+
size = value;
44+
OnPropertyChanged("Calories");
45+
OnPropertyChanged("Price");
46+
OnPropertyChanged("Size");
47+
}
48+
}
4049

4150
private List<string> specialInstructions = new List<string>();
4251
/// <summary>
@@ -59,6 +68,7 @@ public override bool Ice {
5968
if (value == Ice) return;
6069
if (!value) specialInstructions.Add(possibleInstructions[0]);
6170
else specialInstructions.Remove(possibleInstructions[0]);
71+
OnPropertyChanged("Ice");
6272
}
6373
}
6474
/// <summary>
@@ -72,6 +82,7 @@ public bool Lemon {
7282
if (value == Lemon) return;
7383
if (value) specialInstructions.Add(possibleInstructions[1]);
7484
else specialInstructions.Remove(possibleInstructions[1]);
85+
OnPropertyChanged("Lemon");
7586
}
7687
}
7788
/// <summary>

Data/Entrees/BriarheartBurger.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public bool Bun
6464
if (value == Bun) return;
6565
if (!value) specialInstructions.Add(possibleInstructions[0]);
6666
else specialInstructions.Remove(possibleInstructions[0]);
67-
}
67+
OnPropertyChanged("Bun");
68+
}
6869
}
6970
/// <summary>
7071
/// If the Briarheart Burger has ketchup
@@ -75,6 +76,7 @@ public bool Ketchup {
7576
if (value == Ketchup) return;
7677
if (!value) specialInstructions.Add(possibleInstructions[1]);
7778
else specialInstructions.Remove(possibleInstructions[1]);
79+
OnPropertyChanged("Ketchup");
7880
}
7981
}
8082
/// <summary>
@@ -86,6 +88,7 @@ public bool Mustard {
8688
if (value == Mustard) return;
8789
if (!value) specialInstructions.Add(possibleInstructions[2]);
8890
else specialInstructions.Remove(possibleInstructions[2]);
91+
OnPropertyChanged("Mustard");
8992
}
9093
}
9194
/// <summary>
@@ -97,6 +100,7 @@ public bool Pickle {
97100
if (value == Pickle) return;
98101
if (!value) specialInstructions.Add(possibleInstructions[3]);
99102
else specialInstructions.Remove(possibleInstructions[3]);
103+
OnPropertyChanged("Pickle");
100104
}
101105
}
102106
/// <summary>
@@ -108,6 +112,7 @@ public bool Cheese {
108112
if (value == Cheese) return;
109113
if (!value) specialInstructions.Add(possibleInstructions[4]);
110114
else specialInstructions.Remove(possibleInstructions[4]);
115+
OnPropertyChanged("Cheese");
111116
}
112117
}
113118

Data/Entrees/DoubleDraugr.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public bool Bun {
5858
if (value == Bun) return;
5959
if (!value) specialInstructions.Add(possibleInstructions[0]);
6060
else specialInstructions.Remove(possibleInstructions[0]);
61+
OnPropertyChanged("Bun");
6162
}
6263
}
6364
/// <summary>
@@ -69,6 +70,7 @@ public bool Ketchup {
6970
if (value == Ketchup) return;
7071
if (!value) specialInstructions.Add(possibleInstructions[1]);
7172
else specialInstructions.Remove(possibleInstructions[1]);
73+
OnPropertyChanged("Ketchup");
7274
}
7375
}
7476
/// <summary>
@@ -80,6 +82,7 @@ public bool Mustard {
8082
if (value == Mustard) return;
8183
if (!value) specialInstructions.Add(possibleInstructions[2]);
8284
else specialInstructions.Remove(possibleInstructions[2]);
85+
OnPropertyChanged("Mustard");
8386
}
8487
}
8588
/// <summary>
@@ -91,6 +94,7 @@ public bool Pickle {
9194
if (value == Pickle) return;
9295
if (!value) specialInstructions.Add(possibleInstructions[3]);
9396
else specialInstructions.Remove(possibleInstructions[3]);
97+
OnPropertyChanged("Pickle");
9498
}
9599
}
96100
/// <summary>
@@ -102,6 +106,7 @@ public bool Cheese {
102106
if (value == Cheese) return;
103107
if (!value) specialInstructions.Add(possibleInstructions[4]);
104108
else specialInstructions.Remove(possibleInstructions[4]);
109+
OnPropertyChanged("Cheese");
105110
}
106111
}
107112
/// <summary>
@@ -113,6 +118,7 @@ public bool Tomato {
113118
if (value == Tomato) return;
114119
if (!value) specialInstructions.Add(possibleInstructions[5]);
115120
else specialInstructions.Remove(possibleInstructions[5]);
121+
OnPropertyChanged("Tomato");
116122
}
117123
}
118124
/// <summary>
@@ -124,6 +130,7 @@ public bool Lettuce {
124130
if (value == Lettuce) return;
125131
if (!value) specialInstructions.Add(possibleInstructions[6]);
126132
else specialInstructions.Remove(possibleInstructions[6]);
133+
OnPropertyChanged("Lettuce");
127134
}
128135
}
129136
/// <summary>
@@ -135,6 +142,7 @@ public bool Mayo {
135142
if (value == Mayo) return;
136143
if (!value) specialInstructions.Add(possibleInstructions[7]);
137144
else specialInstructions.Remove(possibleInstructions[7]);
145+
OnPropertyChanged("Mayo");
138146
}
139147
}
140148

Data/Entrees/Entree.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Text;
4+
using System.ComponentModel;
45

56
/*
67
* Author: Riley Mueller
@@ -12,7 +13,7 @@ namespace BleakwindBuffet.Data.Entrees
1213
/// <summary>
1314
/// Class for representing a general entree
1415
/// </summary>
15-
public abstract class Entree : IOrderItem
16+
public abstract class Entree : IOrderItem, INotifyPropertyChanged
1617
{
1718
/// <summary>
1819
/// The display name of the entree
@@ -35,6 +36,20 @@ public abstract class Entree : IOrderItem
3536
/// </summary>
3637
public abstract List<string> SpecialInstructions { get; }
3738

39+
/// <summary>
40+
/// Event invoked when a property is changed
41+
/// </summary>
42+
public event PropertyChangedEventHandler PropertyChanged;
43+
44+
/// <summary>
45+
/// Wrapper method so that child classes may invoke PropertyChanged
46+
/// </summary>
47+
/// <param name="propertyName">String representing the property name</param>
48+
protected virtual void OnPropertyChanged(string propertyName)
49+
{
50+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
51+
}
52+
3853
/// <summary>
3954
/// Returns a description of the entree
4055
/// </summary>

Data/Entrees/GardenOrcOmelette.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public bool Broccoli {
5959
if (value == Broccoli) return;
6060
if (!value) specialInstructions.Add(possibleInstructions[0]);
6161
else specialInstructions.Remove(possibleInstructions[0]);
62+
OnPropertyChanged("Broccoli");
6263
}
6364
}
6465
/// <summary>
@@ -70,6 +71,7 @@ public bool Tomato {
7071
if (value == Tomato) return;
7172
if (!value) specialInstructions.Add(possibleInstructions[1]);
7273
else specialInstructions.Remove(possibleInstructions[1]);
74+
OnPropertyChanged("Tomato");
7375
}
7476
}
7577
/// <summary>
@@ -81,6 +83,7 @@ public bool Mushrooms {
8183
if (value == Mushrooms) return;
8284
if (!value) specialInstructions.Add(possibleInstructions[2]);
8385
else specialInstructions.Remove(possibleInstructions[2]);
86+
OnPropertyChanged("Mushrooms");
8487
}
8588
}
8689
/// <summary>
@@ -92,6 +95,7 @@ public bool Cheddar {
9295
if (value == Cheddar) return;
9396
if (!value) specialInstructions.Add(possibleInstructions[3]);
9497
else specialInstructions.Remove(possibleInstructions[3]);
98+
OnPropertyChanged("Cheddar");
9599
}
96100
}
97101

0 commit comments

Comments
 (0)