Commit eee53a4e authored by islater's avatar islater
Browse files

Added implimentation of sizes and flavors'

parent 1ecc8edc
......@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.ComponentModel;
namespace CowboyCafe.Data
{
......@@ -51,6 +52,8 @@ namespace CowboyCafe.Data
throw new NotImplementedException("unknown size");
}
}
/// <summary>
/// Returns the Calories in the item
......
......@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace CowboyCafe.Data
......@@ -21,6 +22,11 @@ namespace CowboyCafe.Data
/// </summary>
public abstract bool Ice { get; set; }
/// <summary>
/// Gives the values of sizes for databinding
/// </summary>
public virtual IEnumerable<Size> SizeValues => Enum.GetValues(typeof(Size)).Cast<Size>();
/// <summary>
/// Gets the size of the drink
/// </summary>
......
......@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace CowboyCafe.Data
......@@ -17,6 +18,11 @@ namespace CowboyCafe.Data
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Gives the values of sizes for databinding
/// </summary>
public virtual IEnumerable<SodaFlavor> FlavorValue => Enum.GetValues(typeof(SodaFlavor)).Cast<SodaFlavor>();
/// <summary>
/// Determines the size of the drink
/// </summary>
......
......@@ -37,12 +37,23 @@ namespace CowboyCafe.Data
public void OnInstructionAdded(object sender, PropertyChangedEventArgs e)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Subtotal"));
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Items"));
if (sender is IOrderItem i)
{
//if (items.Find(i).Price != i.Price)
//{
//}
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Subtotal"));
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Items"));
}
}
public void Remove(IOrderItem i)
{
items.Remove(i);
this.Subtotal -= i.Price;
}
......
......@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace CowboyCafe.Data
......@@ -21,6 +22,11 @@ namespace CowboyCafe.Data
/// </summary>
public abstract Size Size { get; set; }
/// <summary>
/// Gives the values of sizes for databinding
/// </summary>
public virtual IEnumerable<Size> SizeValues => Enum.GetValues(typeof(Size)).Cast<Size>();
/// <summary>
/// Gets the price of the side
/// </summary>
......
......@@ -17,23 +17,28 @@
<ScaleTransform ScaleX="2" ScaleY="2"/>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ComboBox">
<Setter Property="SelectedItem" Value="{Binding Path=Size}"/>
<Setter Property="ItemsSource" Value="{Binding Path=SizeValues}"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Width" Value="334"/>
</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ListBox Name="LeftBox" Grid.Column="0" />
<ListBox Name="RightBox" Grid.Column="1" />
<Button VerticalAlignment="Bottom" Content="Select Menu Items" HorizontalAlignment="Center" Grid.ColumnSpan="2" Click="Button_Click" Height="50" Width="272" Grid.RowSpan="2"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ListBox Name="LeftBox" Grid.Column="0" />
<ListBox Name="RightBox" Grid.Column="1" />
<Button VerticalAlignment="Bottom" Content="Select Menu Items" HorizontalAlignment="Center" Grid.ColumnSpan="2" Click="Button_Click" Height="50" Width="272" Grid.RowSpan="2"/>
</Grid>
</Grid>
</UserControl>
......@@ -96,7 +96,28 @@ namespace PointOfSale
}
else if (item is Side)
{
// if(item is )
if (item is ChiliCheeseFries ccf)
{
DataContext = ccf;
SizeControll();
}
else if (item is CornDodgers cd)
{
DataContext = cd;
SizeControll();
}
else if (item is BakedBeans bb)
{
DataContext = bb;
SizeControll();
}
else if (item is PanDeCampo pdc)
{
DataContext = pdc;
SizeControll();
}
}
else
{
......@@ -106,6 +127,7 @@ namespace PointOfSale
}
//*****************************************************************************************************************
private void BasicsControll()
{
CheckBox Bread = new CheckBox();
......@@ -337,8 +359,10 @@ namespace PointOfSale
LeftBox.Items.Add(GreenOnions);
RightBox.Items.Add(TortillaStrips);
}
private void IceControll()
//*****************************************************************************************************************
private void DrinkBasics()
{
SizeControll();
CheckBox Ice = new CheckBox();
Ice.Content = "Ice";
Ice.HorizontalAlignment = HorizontalAlignment.Right;
......@@ -388,12 +412,12 @@ namespace PointOfSale
private void WaterControll()
{
LemonControll();
IceControll();
DrinkBasics();
}
private void CowboyCoffeeControll()
{
IceControll();
DrinkBasics();
CheckBox Decaf = new CheckBox();
Decaf.Content = "Decaf";
......@@ -426,7 +450,7 @@ namespace PointOfSale
private void TexasTeaControll()
{
IceControll();
DrinkBasics();
LemonControll();
SweetControll();
......@@ -434,9 +458,36 @@ namespace PointOfSale
private void JerkedSodaControll()
{
IceControll();
ComboBox Flavor = new ComboBox();
BindingOperations.SetBinding(Flavor, ComboBox.SelectedValueProperty,new Binding()
{
Source = DataContext,
Path = new PropertyPath("Flavor"),
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
Mode = BindingMode.TwoWay
}
);
BindingOperations.SetBinding(Flavor, ComboBox.ItemsSourceProperty, new Binding()
{
Source = DataContext,
Path = new PropertyPath("FlavorValue"),
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
Mode = BindingMode.OneWay
}
);
RightBox.Items.Add(Flavor);
DrinkBasics();
}
//*****************************************************************************************************************
private void SizeControll()
{
LeftBox.Items.Add(new ComboBox());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment