Commit 0f21fcc2 authored by islater's avatar islater
Browse files

Added implimentations for many things

parent cba1b8e5
......@@ -6,15 +6,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace CowboyCafe.Data
{
public class AngryChicken : Entree
public class AngryChicken : Entree// INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// The price of the Sandwich
/// </summary>
......@@ -44,17 +48,26 @@ namespace CowboyCafe.Data
public bool Bread
{
get { return bread; }
set { bread = value; }
set {
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Bread"));
bread = value;
}
}
private bool pickle =true;
/// <summary>
/// Determins if the sandwich has pickles.
/// </summary>
public bool Pickle
{
get { return pickle; }
set { pickle = value; }
set {
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Pickle"));
pickle = value;
}
}
public override List<string> SpecialInstructions
......@@ -65,7 +78,6 @@ namespace CowboyCafe.Data
if (!bread) instructions.Add("hold bread");
if (!pickle) instructions.Add("hold pickle");
return instructions;
}
}
......
......@@ -5,6 +5,7 @@
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace CowboyCafe.Data
......@@ -14,7 +15,7 @@ namespace CowboyCafe.Data
/// </summary>
public abstract class Drink : IOrderItem
{
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Holds wehter or not a drink has ice
/// </summary>
......
......@@ -5,18 +5,22 @@
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace CowboyCafe.Data
{
public abstract class Entree : IOrderItem
public abstract class Entree:IOrderItem//, INotifyPropertyChanged
{
/// <summary>
/// skeleton parameter for price variable
/// </summary>
public abstract double Price { get; }
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// skeleton parameter for price variable
/// </summary>
public abstract double Price { get; }
/// <summary>
/// skeleton parameter for the calories variable
......
......@@ -5,13 +5,15 @@
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace CowboyCafe.Data
{
public interface IOrderItem
public interface IOrderItem :INotifyPropertyChanged
{
double Price { get; }
public event PropertyChangedEventHandler PropertyChanged;
double Price { get; }
uint Calories { get; }
List<String> SpecialInstructions { get; }
......
......@@ -11,6 +11,7 @@ namespace CowboyCafe.Data
{
public class JerkedSoda: Drink
{
/// <summary>
/// Determines the size of the drink
/// </summary>
......
......@@ -18,20 +18,29 @@ namespace CowboyCafe.Data
public event PropertyChangedEventHandler PropertyChanged;
public double Subtotal { get; set; } = 0.00;
private List<IOrderItem> items = new List<IOrderItem>();
public IEnumerable<IOrderItem> Items {get => items.ToArray();}
public void Add(IOrderItem i)
{
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)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Subtotal"));
PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Items"));
}
public void Remove(IOrderItem i)
{
......
......@@ -5,6 +5,7 @@
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace CowboyCafe.Data
......@@ -14,6 +15,7 @@ namespace CowboyCafe.Data
/// </summary>
public abstract class Side : IOrderItem
{
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Gets the size of the entree
/// </summary>
......
<UserControl x:Class="PointOfSale.DrinkCustomizationControll"
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="420" d:DesignWidth="700">
<Grid>
</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 DrinkCustomizationControll.xaml
/// </summary>
public partial class DrinkCustomizationControll : UserControl
{
public DrinkCustomizationControll()
{
InitializeComponent();
}
}
}
<UserControl
Name="EntreeCustomizationWindow"
x:Class="PointOfSale.EntreeCustomizationControl"
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="420" d:DesignWidth="700">
<UserControl.Resources>
<Style TargetType="CheckBox">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="LayoutTransform">
<Setter.Value>
<ScaleTransform ScaleX="2" ScaleY="2"/>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Border Name="border">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!--<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>-->
<ListBox Name="LeftBox" Grid.Column="0" />
<ListBox Name="RightBox" Grid.Column="1" />
<!--<CheckBox IsChecked="{Binding Path=Bread, Mode=TwoWay}" HorizontalAlignment="Right" Unchecked="CheckBox_Checked" Checked="CheckBox_Checked" Content="Bread" Grid.Column="0" Grid.Row="0" />-->
<Button VerticalAlignment="Bottom" Content="Select Menu Items" HorizontalAlignment="Center" Grid.ColumnSpan="2" Click="Button_Click" Height="50" Width="272" Grid.RowSpan="2"/>
<!--<TextBlock Name="Box" HorizontalAlignment="Left" Margin="309,0,0,0" Grid.Row="3" Text="TextBlock" TextWrapping="Wrap" VerticalAlignment="Center" Grid.ColumnSpan="2" Height="187" Width="166"/>-->
</Grid>
</Border>
</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.ComponentModel;
using System.Windows.Navigation;
using System.Windows.Shapes;
using CowboyCafe.Data;
namespace PointOfSale
{
/// <summary>
/// Interaction logic for EntreeCustomizationControl.xaml
/// </summary>
public partial class EntreeCustomizationControl : UserControl
{
public EntreeCustomizationControl(IOrderItem item)
{
InitializeComponent();
//DataContext = (AngryChicken)item;
if (item is AngryChicken ac)
{
DataContext = ac;
BasicsControll();
}
else if (item is CowpokeChili cp)
{
DataContext = cp;
}
else if (item is DakotaDoubleBurger ddb)
{
DataContext = ddb;
//AngryChickenControll();
}
else if (item is PecosPulledPork ppp)
{
DataContext = ppp;
BasicsControll();
}
else if (item is RustlersRibs rr)
{
//border.Child = new OrderControl();
//DataContext = rr;
//AngryChickenControll();
}
else if (item is TexasTripleBurger ttb)
{
DataContext = ttb;
//AngryChickenControll();
}
else if (item is TrailBurger tb)
{
DataContext = tb;
//AngryChickenControll();
}
else
{
throw new NotImplementedException("Menu Item not accounted for");
}
}
private void BasicsControll()
{
CheckBox Bread = new CheckBox();
Bread.Content = "Bread";
var BreadBinding = new Binding()
{
Source = DataContext,
Path = new PropertyPath("Bread"),
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
Mode = BindingMode.TwoWay
};
BindingOperations.SetBinding(Bread, CheckBox.IsCheckedProperty, BreadBinding);
CheckBox Pickle = new CheckBox();
Pickle.Content = "Pickle";
var PickleBinding = new Binding()
{
Source = DataContext,
Path = new PropertyPath("Pickle"),
Mode = BindingMode.TwoWay,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
};
BindingOperations.SetBinding(Pickle, CheckBox.IsCheckedProperty, PickleBinding);
LeftBox.Items.Add(Bread);
RightBox.Items.Add(Pickle);
}
private void CowPokeChiliControll()
{ }
private void DakotaDoubleControll()
{ }
private void PecosPulledPorkControll()
{ }
private void RustlersRibsControll()
{ }
private void TexasTripleControll()
{ }
private void TrailBurgerControll()
{ }
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
((CheckBox)sender).GetBindingExpression(CheckBox.IsCheckedProperty).UpdateTarget();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
border.Child = new OrderControl();
}
}
}
......@@ -17,45 +17,47 @@
<Style TargetType="TextBlock">
<Setter Property = "FontSize" Value = "25" />
</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel>
<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>
<Button Name="PecosPulledPorkButton" Click="PecosPulledPorkButton_Click">Pecos Pulled Pork</Button>
<Button Name="RustlersRibsButton" Click="RustlersRibsButton_Click">Rustlers Ribs</Button>
<Button Name="TexasTripleButton" Click="TexasTripleButton_Click">Texas Triple</Button>
<Button Name="TrailBurgerButton" Click="TrailBurgerButton_Click">Trail Burger</Button>
</StackPanel>
<StackPanel Grid.Column="1">
<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>
</StackPanel>
<StackPanel Grid.Column="2">
<TextBlock TextAlignment="Center">Drinks</TextBlock>
<Button Name="JerkedSodeButton" Click="JerkedSodeButton_Click">Jerked Soda</Button>
<Button Name="CowboyCoffeButton" Click="CowboyCoffeButton_Click">Cowboy Coffe</Button>
<Button Name="TexasTeaButton" Click="TexasTeaButton_Click">Texas Tea</Button>
<Button Name="WaterButton" Click="WaterButton_Click">Water</Button>
</StackPanel>
<ListBox Width="0" Name="ticket"/>
</Grid>
<Border Name="MainWindow" BorderThickness="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel>
<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>
<Button Name="PecosPulledPorkButton" Click="PecosPulledPorkButton_Click">Pecos Pulled Pork</Button>
<Button Name="RustlersRibsButton" Click="RustlersRibsButton_Click">Rustlers Ribs</Button>
<Button Name="TexasTripleButton" Click="TexasTripleButton_Click">Texas Triple</Button>
<Button Name="TrailBurgerButton" Click="TrailBurgerButton_Click">Trail Burger</Button>
</StackPanel>
<StackPanel Grid.Column="1">
<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>
</StackPanel>
<StackPanel Grid.Column="2">
<TextBlock TextAlignment="Center">Drinks</TextBlock>
<Button Name="JerkedSodeButton" Click="JerkedSodeButton_Click">Jerked Soda</Button>
<Button Name="CowboyCoffeButton" Click="CowboyCoffeButton_Click">Cowboy Coffe</Button>
<Button Name="TexasTeaButton" Click="TexasTeaButton_Click">Texas Tea</Button>
<Button Name="WaterButton" Click="WaterButton_Click">Water</Button>
</StackPanel>
<ListBox Width="0" Name="ticket"/>
</Grid>
</Border>
</UserControl>
......@@ -35,11 +35,16 @@ namespace PointOfSale
private void AngryChickenButton_Click(object sender, RoutedEventArgs e)
{
AngryChicken ac = new AngryChicken();
if (DataContext is Order order)
{
ac.PropertyChanged += order.OnInstructionAdded;
order.Add(ac);
}
}
MainWindow.Child = new EntreeCustomizationControl(ac);
//DataContext = order;
//order.Add(ac);
}
private void CowpokeChiliButton_Click(object sender, RoutedEventArgs e)
......
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
......
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