Add project files.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using DE70_CMDv2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SafeBagDE70
|
||||
{
|
||||
public static class AppData
|
||||
{
|
||||
public static List<CustomerAccount>? customerAccounts = null;
|
||||
public static CustomerAccount? CurrentCustomerAccount{get;set;}
|
||||
public static CCmdRsp? cCmdRsp=null;
|
||||
public static bool IsAuthenticated = false;
|
||||
public static bool IsInTransaction = false;
|
||||
public static int WDTCount = 0;
|
||||
public static void Init()
|
||||
{
|
||||
customerAccounts = new List<CustomerAccount>{
|
||||
new CustomerAccount{Name="NGUYỄN ĐÌNH THUẬN",CustomerId="HUE_0000000001",QRCode="HUE_0000000001",PINCode="H0001" },
|
||||
new CustomerAccount{Name="HOÀNG VĂN HIỆP",CustomerId="HUE_0000000002",QRCode="HUE_0000000002",PINCode="H0002" },
|
||||
new CustomerAccount{Name="PHẠM NGỌC HƯNG",CustomerId="HUE_0000000003",QRCode="HUE_0000000003",PINCode="H0003" }
|
||||
};
|
||||
CurrentCustomerAccount = customerAccounts[0];
|
||||
}
|
||||
public static void LogAction(string strAction, string? strData)
|
||||
{
|
||||
if (strData != null) strData = "Data: " + strData;
|
||||
File.AppendAllText("log.txt", "\r\n" + DateTime.Now.ToString("yyyyMMddHHmmss: ") +
|
||||
"Action: " + strAction + " " + strData);
|
||||
}
|
||||
|
||||
public static void LogException(string strAction, string? strData)
|
||||
{
|
||||
if (strData != null) strData = "Data: " + strData;
|
||||
File.AppendAllText("logException.txt", "\r\n" + DateTime.Now.ToString("yyyyMMddHHmmss: ") +
|
||||
"Action: " + strAction + " " + strData);
|
||||
}
|
||||
}
|
||||
public class CustomerAccount
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public string? CustomerId { get; set; }
|
||||
public string? QRCode { get; set; }
|
||||
public string? PINCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
<UserControl x:Class="SafeBagDE70.DepositSMUC"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:SafeBagDE70"
|
||||
mc:Ignorable="d"
|
||||
Width="1280"
|
||||
Height="1024"
|
||||
Background="#F0F0F0"
|
||||
Loaded="UserControl_Loaded"
|
||||
Unloaded="UserControl_Unloaded">
|
||||
<UserControl.Resources>
|
||||
<local:LastItemIndexConverter x:Key="LastItemIndexConverter" />
|
||||
<DataTemplate x:Key="BoldTemplateWithSeparator">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<!-- Separator Row -->
|
||||
<RowDefinition Height="2"/>
|
||||
<!-- Data Row -->
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Separator Line -->
|
||||
<Rectangle Grid.Row="0" Height="2" Fill="Gray" HorizontalAlignment="Stretch"/>
|
||||
|
||||
<!-- Data Content for Last Row -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding Name}" FontWeight="Bold" Grid.Column="0" />
|
||||
<TextBlock Text="{Binding Quantity}" FontWeight="Bold" Grid.Column="1" />
|
||||
<TextBlock Text="{Binding Value}" FontWeight="Bold" Grid.Column="2" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</UserControl.Resources>
|
||||
<Border BorderThickness="1" BorderBrush="Gray" Margin="10">
|
||||
<Grid x:Name="gridMainPanel">
|
||||
<!--<ContentControl x:Name="MainContent" />-->
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border BorderThickness="0" Background="#003366">
|
||||
<StackPanel Grid.Row="0" >
|
||||
<Label
|
||||
x:Name="lblName"
|
||||
Background="Transparent"
|
||||
Foreground="White"
|
||||
BorderThickness="0"
|
||||
FontWeight="Bold"
|
||||
FontSize="30"
|
||||
Height="50"/>
|
||||
|
||||
<Label HorizontalAlignment="Center"
|
||||
x:Name="lblUser"
|
||||
Background="Transparent"
|
||||
Foreground="White"
|
||||
BorderThickness="0"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
Height="50"/>
|
||||
<Border BorderThickness="1" BorderBrush="Gray">
|
||||
<Separator BorderThickness="2" BorderBrush="Gray"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1" x:Name="gridMain" VerticalAlignment="Center" Margin="5" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="300"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
|
||||
<Button HorizontalAlignment="Stretch"
|
||||
Content="BẮT ĐẦU"
|
||||
x:Name="btnStart"
|
||||
Click="btnCommon_Click"
|
||||
FontSize="30"
|
||||
FontWeight="Bold"
|
||||
Height="80"
|
||||
Margin="10,0,10,10"
|
||||
Background="#4CAF50" Foreground="White"/>
|
||||
|
||||
<Button HorizontalAlignment="Stretch"
|
||||
Content="NỘP TIỀN"
|
||||
x:Name="btnCountStart"
|
||||
Click="btnCommon_Click"
|
||||
FontSize="30"
|
||||
FontWeight="Bold"
|
||||
Height="80"
|
||||
Margin="10"
|
||||
Background="#2196F3" Foreground="White"/>
|
||||
<Button HorizontalAlignment="Stretch"
|
||||
Content="KIỂM TRA"
|
||||
x:Name="btnCheck"
|
||||
Click="btnCommon_Click"
|
||||
FontSize="30"
|
||||
FontWeight="Bold"
|
||||
Height="80"
|
||||
Margin="10"
|
||||
Background="#2196F3" Foreground="White"
|
||||
/>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2">
|
||||
<Button HorizontalAlignment="Stretch"
|
||||
Content="LƯU TRỮ"
|
||||
x:Name="btnStoreStart"
|
||||
Click="btnCommon_Click"
|
||||
FontSize="30"
|
||||
FontWeight="Bold"
|
||||
Height="80"
|
||||
Margin="10,0,10,10"
|
||||
Background="#4CAF50" Foreground="White"/>
|
||||
<Button HorizontalAlignment="Stretch"
|
||||
Content="KẾT THÚC"
|
||||
FontWeight="Bold"
|
||||
x:Name="btnEnd"
|
||||
Click="btnCommon_Click"
|
||||
FontSize="30"
|
||||
Height="80"
|
||||
Margin="10"
|
||||
Background="#4CAF50" Foreground="White"/>
|
||||
<Button HorizontalAlignment="Stretch"
|
||||
Content="THOÁT"
|
||||
FontWeight="Bold"
|
||||
x:Name="btnLogout"
|
||||
Click="btnCommon_Click"
|
||||
FontSize="30"
|
||||
Height="80"
|
||||
Margin="10"
|
||||
Background="Red" Foreground="White"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1">
|
||||
<ListView HorizontalAlignment="Center" FontSize="30" Width="600" x:Name="lvCount"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
ScrollViewer.CanContentScroll="False"
|
||||
Background="Transparent">
|
||||
<ListView.Resources>
|
||||
<!-- Style for GridViewColumnHeader to set font to bold -->
|
||||
<Style TargetType="GridViewColumnHeader">
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</Style>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
||||
</Style>
|
||||
|
||||
</ListView.Resources>
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="Mệnh giá"
|
||||
|
||||
DisplayMemberBinding="{Binding Name}"
|
||||
Width="200"/>
|
||||
<GridViewColumn Header="Số lượng"
|
||||
DisplayMemberBinding="{Binding Quantity}"
|
||||
Width="150"/>
|
||||
<GridViewColumn Header="Thành tiền"
|
||||
DisplayMemberBinding="{Binding Value}"
|
||||
Width="200"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Right"/>
|
||||
<Setter Property="BorderThickness" Value="0,0,0,1"/>
|
||||
<Style.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<!-- Condition 1: Check if AlternationIndex equals Item Count - 1 -->
|
||||
<Condition Value="True">
|
||||
<Condition.Binding>
|
||||
<MultiBinding Converter="{StaticResource LastItemIndexConverter}">
|
||||
<Binding Path="Name"/>
|
||||
</MultiBinding>
|
||||
</Condition.Binding>
|
||||
</Condition>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
</ListView>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="2" Background="#003366">
|
||||
<Separator BorderThickness="2" BorderBrush="Gray"/>
|
||||
<Label Height="40" x:Name="lblStatus" Background="Transparent" BorderThickness="0" Foreground="Red" FontSize="20" Content="TRẠNG THÁI"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user