Commit bbb48088 authored by Ian Slater's avatar Ian Slater
Browse files

Added more bindings for wpf

parent b5ba9b47
......@@ -69,6 +69,9 @@ namespace CowboyCafe.Data
return instructions;
}
}
/// <summary>
/// Changs to string to be the
/// </summary>
......
......@@ -12,7 +12,7 @@ namespace CowboyCafe.Data
/// <summary>
/// A base class representing a side
/// </summary>
public abstract class Drink
public abstract class Drink : IOrderItem
{
/// <summary>
......
......@@ -14,7 +14,7 @@ namespace CowboyCafe.Data
public double Subtotal { get; set; } = 10.0;
public double Subtotal { get; set; } = 0.00;
private List<IOrderItem> items = new List<IOrderItem>();
......@@ -26,9 +26,6 @@ namespace CowboyCafe.Data
this.Subtotal += i.Price;
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Subtotal"));
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Items"));
}
public void Remove(IOrderItem i)
{
......
......@@ -12,7 +12,7 @@ namespace CowboyCafe.Data
/// <summary>
/// A base class representing a side
/// </summary>
public abstract class Side
public abstract class Side : IOrderItem
{
/// <summary>
/// Gets the size of the entree
......@@ -28,5 +28,7 @@ namespace CowboyCafe.Data
/// Gets the calories of the entree
/// </summary>
public abstract uint Calories { get; }
public virtual List<string> SpecialInstructions { get => new List<string>(); }
}
}
......@@ -5,17 +5,21 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PointOfSale"
mc:Ignorable="d"
Title="MainWindow" Height="600" Width="1000">
Title="MainWindow" Height="632" Width="1000">
<Grid RenderTransformOrigin="0.568,0.499">
<Grid.RowDefinitions>
<RowDefinition Height="127"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="300"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="1" Grid.RowSpan="4" BorderBrush="Black"
<Border Grid.Column="1" Grid.RowSpan="2" BorderBrush="Black"
BorderThickness="1,0,0,0" Background="{x:Null}" />
<local:OrderControl x:Name="ordercontrol" Height="420" Grid.Column="0" Margin="0,84,0,0" />
<local:OrderSummaryControl x:Name="ordersummarycontrol" Grid.Column="1"/>
<local:MenuSelectionControl Grid.Column="0" Grid.Row="0" x:Name="menuselectioncontrol" Height="151" VerticalAlignment="Top" Grid.RowSpan="2"/>
<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>
</Window>
<UserControl x:Class="PointOfSale.MenuSelectionControl"
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"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PointOfSale"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="700">
<UserControl.Resources>
<Style TargetType="Button">
<Setter Property="Height" Value="80"/>
<Setter Property="Width" Value="220"/>
<Setter Property = "FontSize" Value = "23" />
</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Name="ItemSelectionButon" Click="ItemSelectionButon_Click" >Item Selection</Button>
<Button Grid.Column="1" Name="CancelOrderButon" Click="CancelOrderButon_Click" >Cancel Order</Button>
<Button Grid.Column="2" Name="CompleteOrderButon" Click="CompleteOrderButon_Click" >Complete Order</Button>
</Grid>
</UserControl>
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace PointOfSale
{
/// <summary>
/// Interaction logic for UserControl1.xaml
/// </summary>
public partial class MenuSelectionControl : UserControl
{
public MenuSelectionControl()
{
InitializeComponent();
}
private void ItemSelectionButon_Click(object sender, RoutedEventArgs e)
{
}
private void CancelOrderButon_Click(object sender, RoutedEventArgs e)
{
}
private void CompleteOrderButon_Click(object sender, RoutedEventArgs e)
{
}
}
}
......@@ -15,7 +15,6 @@
<Setter Property = "FontSize" Value = "23" />
</Style>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="5"/>
<Setter Property = "FontSize" Value = "25" />
</Style>
</UserControl.Resources>
......@@ -26,7 +25,7 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock TextAlignment="Center">Enrees</TextBlock>
<TextBlock TextAlignment="Center">Entrees</TextBlock>
<Button Name="AngryChickenButton" Click="AngryChickenButton_Click">Angry Chicken</Button>
<Button Name="CowpokeChiliButton" Click="CowpokeChiliButton_Click">CowPoke Chili</Button>
<Button Name="DakotaDoubleButton" Click="DakotaDoubleButton_Click">Dakto Double</Button>
......@@ -38,7 +37,7 @@
</StackPanel>
<StackPanel Grid.Column="1">
<TextBlock TextAlignment="Center">sides</TextBlock>
<TextBlock TextAlignment="Center">Sides</TextBlock>
<Button Name="ChiliCheeseFriesButton" Click="ChiliCheeseFriesButton_Click">ChillieCheese Fries</Button>
<Button Name="CornDodgerButton" Click="CornDodgerButton_Click">Corn Dodgers</Button>
<Button Name="PandeCampoButton" Click="PandeCampoButton_Click">Pan de Campo</Button>
......
......@@ -28,6 +28,8 @@ namespace PointOfSale
public OrderControl()
{
InitializeComponent();
}
private void AngryChickenButton_Click(object sender, RoutedEventArgs e)
......@@ -43,67 +45,132 @@ namespace PointOfSale
private void CowpokeChiliButton_Click(object sender, RoutedEventArgs e)
{
CowpokeChili cp = new CowpokeChili();
if (DataContext is Order order)
{
order.Add(cp);
}
}
private void DakotaDoubleButton_Click(object sender, RoutedEventArgs e)
{
DakotaDoubleBurger ddb = new DakotaDoubleBurger();
if (DataContext is Order order)
{
order.Add(ddb);
}
}
private void PecosPulledPorkButton_Click(object sender, RoutedEventArgs e)
{
PecosPulledPork ppp = new PecosPulledPork();
if (DataContext is Order order)
{
order.Add(ppp);
}
}
private void RustlersRibsButton_Click(object sender, RoutedEventArgs e)
{
RustlersRibs rr = new RustlersRibs();
if (DataContext is Order order)
{
order.Add(rr);
}
}
private void TexasTripleButton_Click(object sender, RoutedEventArgs e)
{
TexasTripleBurger ttb = new TexasTripleBurger();
if (DataContext is Order order)
{
order.Add(ttb);
}
}
private void TrailBurgerButton_Click(object sender, RoutedEventArgs e)
{
TrailBurger tb = new TrailBurger();
if (DataContext is Order order)
{
order.Add(tb);
}
}
private void ChiliCheeseFriesButton_Click(object sender, RoutedEventArgs e)
{
ChiliCheeseFries ccf = new ChiliCheeseFries();
if (DataContext is Order order)
{
order.Add(ccf);
}
}
private void CornDodgerButton_Click(object sender, RoutedEventArgs e)
{
CornDodgers cd = new CornDodgers();
if (DataContext is Order order)
{
order.Add(cd);
}
}
private void PandeCampoButton_Click(object sender, RoutedEventArgs e)
{
PanDeCampo pdc = new PanDeCampo();
if (DataContext is Order order)
{
order.Add(pdc);
}
}
private void JerkedSodeButton_Click(object sender, RoutedEventArgs e)
{
JerkedSoda js = new JerkedSoda();
if (DataContext is Order order)
{
order.Add(js);
}
}
private void CowboyCoffeButton_Click(object sender, RoutedEventArgs e)
{
CowboyCoffee cc = new CowboyCoffee();
if (DataContext is Order order)
{
order.Add(cc);
}
}
private void TexasTeaButton_Click(object sender, RoutedEventArgs e)
{
TexasTea tt = new TexasTea();
if (DataContext is Order order)
{
order.Add(tt);
}
}
private void WaterButton_Click(object sender, RoutedEventArgs e)
{
Water w = new Water();
if (DataContext is Order order)
{
order.Add(w);
}
}
}
}
......@@ -6,38 +6,43 @@
xmlns:local="clr-namespace:PointOfSale"
mc:Ignorable="d"
d:DesignHeight="570" d:DesignWidth="300">
<Grid>
<Border BorderThickness="1" BorderBrush="Black" Margin="10,38,10,60">
<ListBox HorizontalContentAlignment="Stretch" ItemsSource="{Binding Path=Items}" SelectionChanged="ListBox_SelectionChanged" Margin="19,26,23,25">
<UserControl.Resources>
<Style TargetType="TextBlock">
<Setter Property = "FontSize" Value = "20" />
</Style>
</UserControl.Resources>
<Grid>
<Border BorderThickness="1" BorderBrush="Black" Margin="10,38,10,60">
<ListBox HorizontalContentAlignment="Stretch" ItemsSource="{Binding Path=Items}" SelectionChanged="ListBox_SelectionChanged" Margin="0,0,-1,-1">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition />
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding}"></TextBlock>
<TextBlock HorizontalAlignment="Right" Text="{Binding Path=Price}"
<TextBlock Text="{Binding}"></TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Left" Text="{Binding Path=Price}"/>
<ListBox BorderThickness="0" Grid.Row="1" HorizontalAlignment="Center" ItemsSource="{Binding Path=SpecialInstructions}"/>
</Grid>
</DataTemplate>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<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 Name="SubtotalTextBox" HorizontalAlignment="Right" Margin="0,515,10,0" FontSize="20" Text="{Binding Path=Subtotal, StringFormat=c}" TextWrapping="Wrap" VerticalAlignment="Top" Height="45" Width="84"/>
<TextBlock HorizontalAlignment="Left" Margin="10,515,0,0" FontSize="20" TextWrapping="Wrap" VerticalAlignment="Top" Height="45" Width="90">Subtotal</TextBlock>
<TextBlock HorizontalAlignment="Left" Margin="10,-2,0,0" Text="Ticket" FontSize="20" TextWrapping="Wrap" VerticalAlignment="Top" Width="70"/>
<ScrollBar HorizontalAlignment="Left" Margin="263,63,0,0" VerticalAlignment="Top" Height="427"/>
</Grid>
</Grid>
</UserControl>
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