Added Sales Page

Added sales page xaml and supporting View Model.
Just scaffolds out the VM, does not add logic
This commit is contained in:
s459315 2022-07-22 21:20:13 +02:00
parent 4e6ec2c41b
commit ff6653c1bd
4 changed files with 235 additions and 0 deletions

View File

@ -84,10 +84,14 @@
<Compile Include="Helpers\PasswordBoxHelper.cs" />
<Compile Include="Models\AuthenticatedUser.cs" />
<Compile Include="ViewModels\LoginViewModel.cs" />
<Compile Include="ViewModels\SalesViewModel.cs" />
<Compile Include="ViewModels\ShellViewModel.cs" />
<Compile Include="Views\LoginView.xaml.cs">
<DependentUpon>LoginView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SalesView.xaml.cs">
<DependentUpon>SalesView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ShellView.xaml.cs">
<DependentUpon>ShellView.xaml</DependentUpon>
</Compile>
@ -99,6 +103,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SalesView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ShellView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -0,0 +1,124 @@
using Caliburn.Micro;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RMWPFUserInterface.ViewModels
{
public class SalesViewModel : Screen
{
private BindingList<string> _products;
public BindingList<string> Products
{
get { return _products; }
set
{
_products = value;
NotifyOfPropertyChange(() => Products);
}
}
private BindingList<string> _cart;
public BindingList<string> Cart
{
get { return _cart; }
set
{
Cart = value;
NotifyOfPropertyChange(() => Cart);
}
}
private string _itemQuantity;
public string ItemQuantity
{
get { return _itemQuantity; }
set
{
ItemQuantity = value;
NotifyOfPropertyChange(() => ItemQuantity);
}
}
public string SubTotal
{
get
{
// replace with calulation;
return "$0.00";
}
}
public string Tax
{
get
{
// replace with calulation;
return "$0.00";
}
}
public string Total
{
get
{
// replace with calulation;
return "$0.00";
}
}
public bool CanAddToCart
{
get
{
bool output = false;
// Make sure item is selected and quantity is typed in
return output;
}
}
public void AddToCart()
{
}
public bool CanRemoveFromCart
{
get
{
bool output = false;
// Make sure something is selected
return output;
}
}
public void RemoveFromCart()
{
}
public bool CanCheckOut
{
get
{
bool output = false;
// Make sure there is something in the cart
return output;
}
}
public void CheckOut()
{
}
}
}

View File

@ -0,0 +1,75 @@
<UserControl x:Class="RMWPFUserInterface.Views.SalesView"
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:RMWPFUserInterface.Views"
mc:Ignorable="d" Background="White" FontSize="24"
d:DesignHeight="550" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Header -->
<TextBlock Text="Sales Page" FontSize="48"
Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"
Margin="0 0 0 30"/>
<!-- Column 0 -->
<TextBlock Text="Items" Grid.Row="1" Grid.Column="0"/>
<ListBox x:Name="Products" Grid.Row="2" Grid.Column="0"
MinHeight="200" MinWidth="150"/>
<!-- Column 1 -->
<StackPanel Orientation="Vertical" Grid.Column="1"
Grid.Row="2" Margin="20 0" >
<TextBlock Text="Quantity" />
<TextBlock x:Name="ItemQuantity" MinWidth="100" Margin="0 0 0 10"/>
<Button x:Name="AddToCart" Content="Add to Cart" Margin="0 0 0 30"
Padding="5"/>
<Button x:Name="RemoveFromCart" Content="Remove from Cart"
Padding="5"/>
</StackPanel>
<!-- Column 2 -->
<TextBlock Text="Cart" Grid.Row="1" Grid.Column="2"/>
<ListBox x:Name="Cart" Grid.Row="2" Grid.Column="2"
MinHeight="200" MinWidth="150"/>
<DockPanel Grid.Row="3" Grid.Column="2">
<TextBlock Text="SubTotal: " Margin="0 0 15 0"/>
<TextBlock x:Name="SubTotal" Text="$0.00"
TextAlignment="Right"/>
</DockPanel>
<DockPanel Grid.Row="4" Grid.Column="2">
<TextBlock Text="Tax: " />
<TextBlock x:Name="Tax" Text="$0.00"
TextAlignment="Right"/>
</DockPanel>
<DockPanel Grid.Row="5" Grid.Column="2">
<TextBlock Text="Total: " />
<TextBlock x:Name="Total" Text="$0.00"
TextAlignment="Right"/>
</DockPanel>
<Button x:Name="CheckOut" Grid.Row="6" Grid.Column="2"
Content="Check Out"
Margin="0 20 0 0" Padding="5"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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 RMWPFUserInterface.Views
{
/// <summary>
/// Interaction logic for SalesView.xaml
/// </summary>
public partial class SalesView : UserControl
{
public SalesView()
{
InitializeComponent();
}
}
}