Commit 79755b4b authored by islater's avatar islater
Browse files

finished implimentatoin of customization screen

parent eee53a4e
......@@ -26,8 +26,8 @@ namespace CowboyCafe.Data
get { return size; }
set
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
size = value;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
}
}
/// <summary>
......
......@@ -26,8 +26,9 @@ namespace CowboyCafe.Data
get { return size; }
set
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
size = value;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
}
}
/// <summary>
......
......@@ -25,8 +25,8 @@ namespace CowboyCafe.Data
get { return size; }
set
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
size = value;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
}
}
/// <summary>
......
......@@ -26,8 +26,8 @@ namespace CowboyCafe.Data
get { return size; }
set
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
size = value;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
}
}
......
......@@ -18,6 +18,7 @@ namespace CowboyCafe.Data
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Gives the values of sizes for databinding
/// </summary>
......@@ -32,8 +33,8 @@ namespace CowboyCafe.Data
get { return size; }
set
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
size = value;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
}
}
......@@ -60,6 +61,7 @@ namespace CowboyCafe.Data
set
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Flavor"));
flavor = value;
}
}
......
......@@ -14,11 +14,32 @@ namespace CowboyCafe.Data
{
public class Order :INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public Order()
{
OrderNumber += 1;
//PropertyChanged.Invoke(this, new PropertyChangedEventArgs("OrderNumber"));
}
private double subtotal = 0.0;
public double Subtotal
{
get
{
subtotal = 0.0;
foreach (IOrderItem i in items)
{
subtotal += i.Price;
}
return subtotal;
}
}
public double Subtotal { get; set; } = 0.00;
public static uint OrderNumber = 1;
......@@ -30,31 +51,22 @@ namespace CowboyCafe.Data
{
i.PropertyChanged += OnInstructionAdded;
items.Add(i);
this.Subtotal += i.Price;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Subtotal"));
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Items"));
}
public void OnInstructionAdded(object sender, PropertyChangedEventArgs e)
{
if (sender is IOrderItem i)
if (sender != null && this!=null)
{
//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;
}
......
......@@ -27,8 +27,8 @@ namespace CowboyCafe.Data
get { return size; }
set
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
size = value;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
}
}
......
......@@ -28,8 +28,8 @@ namespace CowboyCafe.Data
get { return size; }
set
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
size = value;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Size"));
}
}
......
<UserControl
Name="EntreeCustomizationWindow"
x:Class="PointOfSale.EntreeCustomizationControl"
x:Class="PointOfSale.CustomizationControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
......@@ -22,7 +22,7 @@
<Setter Property="SelectedItem" Value="{Binding Path=Size}"/>
<Setter Property="ItemsSource" Value="{Binding Path=SizeValues}"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Width" Value="334"/>
<Setter Property="Width" Value="328"/>
</Style>
......
......@@ -18,10 +18,10 @@ namespace PointOfSale
/// <summary>
/// Interaction logic for EntreeCustomizationControl.xaml
/// </summary>
public partial class EntreeCustomizationControl : UserControl
public partial class CustomizationControl : UserControl
{
public EntreeCustomizationControl(IOrderItem item)
public CustomizationControl(IOrderItem item)
{
InitializeComponent();
if (item is Entree)
......@@ -91,6 +91,10 @@ namespace PointOfSale
}
else
{
throw new NotImplementedException("Menu Item not accounted for");
}
}
......@@ -117,6 +121,10 @@ namespace PointOfSale
DataContext = pdc;
SizeControll();
}
else
{
throw new NotImplementedException("Menu Item not accounted for");
}
}
else
......@@ -127,7 +135,30 @@ namespace PointOfSale
}
/// <summary>
/// Event handler to rigger when
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
((CheckBox)sender).GetBindingExpression(CheckBox.IsCheckedProperty).UpdateTarget();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
OrderControl orderControll = ((OrderControl)((Border)(this.Parent)).Parent);
orderControll.SwapScreen();
}
//*****************************************************************************************************************
//All the fol
private void BasicsControll()
{
CheckBox Bread = new CheckBox();
......@@ -485,6 +516,7 @@ namespace PointOfSale
//*****************************************************************************************************************
private void SizeControll()
{
LeftBox.Items.Add(new ComboBox());
......@@ -495,17 +527,6 @@ namespace PointOfSale
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
((CheckBox)sender).GetBindingExpression(CheckBox.IsCheckedProperty).UpdateTarget();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
OrderControl orderControll = ((OrderControl)((Border)(this.Parent)).Parent);
orderControll.SwapScreen();
}
}
}
......@@ -18,7 +18,7 @@
</Grid.ColumnDefinitions>
<Border Grid.Column="1" Grid.RowSpan="2" BorderBrush="Black"
BorderThickness="1,0,0,0" Background="{x:Null}" />
<local:MenuSelectionControl Grid.Column="0" Grid.Row="0" x:Name="menuselectioncontrol" Height="151" VerticalAlignment="Top" Grid.RowSpan="2"/>
<local:MenuSelectionControl Grid.Column="0" Grid.Row="0" x:Name="menuselectioncontrol" Height="151" VerticalAlignment="Top" Grid.RowSpan="2" Loaded="menuselectioncontrol_Loaded"/>
<local:OrderControl x:Name="ordercontrol" Grid.Row="1" Grid.Column="0" Margin="0,10,0,48" />
<local:OrderSummaryControl x:Name="ordersummarycontrol" Grid.RowSpan="2" Grid.Column="1"/>
</Grid>
......
......@@ -42,5 +42,10 @@ namespace PointOfSale
{
}
private void menuselectioncontrol_Loaded(object sender, RoutedEventArgs e)
{
}
}
}
......@@ -36,13 +36,14 @@ namespace PointOfSale
private void CancelOrderButon_Click(object sender, RoutedEventArgs e)
{
this.DataContext = new Order();
((MainWindow)((Grid)Parent).Parent).DataContext = new Order();
// DataContext = new Order();
}
private void CompleteOrderButon_Click(object sender, RoutedEventArgs e)
{
DataContext = new Order();
}
}
}
......@@ -38,7 +38,7 @@ namespace PointOfSale
{
order.Add(ac);
ac.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(ac);
MainWindow.Child = new CustomizationControl(ac);
}
......@@ -51,7 +51,7 @@ namespace PointOfSale
{
order.Add(cp);
cp.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(cp);
MainWindow.Child = new CustomizationControl(cp);
}
......@@ -64,7 +64,7 @@ namespace PointOfSale
{
order.Add(ddb);
ddb.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(ddb);
MainWindow.Child = new CustomizationControl(ddb);
}
}
......@@ -76,19 +76,18 @@ namespace PointOfSale
{
order.Add(ppp);
ppp.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(ppp);
MainWindow.Child = new CustomizationControl(ppp);
}
}
private void RustlersRibsButton_Click(object sender, RoutedEventArgs e)
{
RustlersRibs rr = new RustlersRibs();
if (DataContext is Order order)
{
order.Add(rr);
order.Add(new RustlersRibs());
}
}
......@@ -99,7 +98,7 @@ namespace PointOfSale
{
order.Add(ttb);
ttb.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(ttb);
MainWindow.Child = new CustomizationControl(ttb);
}
}
......@@ -111,7 +110,7 @@ namespace PointOfSale
{
order.Add(tb);
tb.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(tb);
MainWindow.Child = new CustomizationControl(tb);
}
}
......@@ -123,7 +122,7 @@ namespace PointOfSale
{
order.Add(ccf);
ccf.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(ccf);
MainWindow.Child = new CustomizationControl(ccf);
}
}
......@@ -134,7 +133,7 @@ namespace PointOfSale
{
order.Add(bb);
bb.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(bb);
MainWindow.Child = new CustomizationControl(bb);
}
}
......@@ -146,7 +145,7 @@ namespace PointOfSale
{
order.Add(cd);
cd.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(cd);
MainWindow.Child = new CustomizationControl(cd);
}
}
......@@ -158,7 +157,7 @@ namespace PointOfSale
{
order.Add(pdc);
pdc.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(pdc);
MainWindow.Child = new CustomizationControl(pdc);
}
}
......@@ -170,7 +169,7 @@ namespace PointOfSale
{
order.Add(js);
js.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(js);
MainWindow.Child = new CustomizationControl(js);
}
}
......@@ -182,7 +181,7 @@ namespace PointOfSale
{
order.Add(cc);
cc.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(cc);
MainWindow.Child = new CustomizationControl(cc);
}
}
......@@ -194,7 +193,7 @@ namespace PointOfSale
{
order.Add(tt);
tt.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(tt);
MainWindow.Child = new CustomizationControl(tt);
}
}
......@@ -206,7 +205,7 @@ namespace PointOfSale
{
order.Add(w);
w.PropertyChanged += order.OnInstructionAdded;
MainWindow.Child = new EntreeCustomizationControl(w);
MainWindow.Child = new CustomizationControl(w);
}
}
......
......@@ -39,6 +39,7 @@
<TextBlock Name="SubtotalTextBox" HorizontalAlignment="Right" Margin="0,533,10,0" FontSize="20" Text="{Binding Path=Subtotal, StringFormat=c}" TextWrapping="Wrap" VerticalAlignment="Top" Height="31" Width="84"/>
<TextBlock HorizontalAlignment="Left" Margin="7,534,0,0" FontSize="20" TextWrapping="Wrap" VerticalAlignment="Top" Height="30" Width="90">Subtotal</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="10,-2,0,0" Text="Ticket" FontSize="20" TextWrapping="Wrap" VerticalAlignment="Top" Width="70"/>
<TextBlock x:Name="OrderNumber" HorizontalAlignment="Left" Margin="206,2,0,0" FontSize="20" Text="{Binding OrderNumber}" TextWrapping="Wrap" VerticalAlignment="Top" Height="31" Width="84"/>
......
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