wait sql init successfully
This commit is contained in:
+6
-4
@@ -37,12 +37,11 @@ namespace SafeBagDE70
|
|||||||
public static string BaseURL = "";
|
public static string BaseURL = "";
|
||||||
public static int TenantId = 0;
|
public static int TenantId = 0;
|
||||||
public static DeviceStatus? DeviceStatus = null;
|
public static DeviceStatus? DeviceStatus = null;
|
||||||
|
public static bool bInitUser = false;
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
CDMSTATE = new CDMSTATE();
|
CDMSTATE = new CDMSTATE();
|
||||||
DeviceStatus = new DeviceStatus
|
DeviceStatus = new DeviceStatus
|
||||||
{
|
{
|
||||||
@@ -55,7 +54,7 @@ namespace SafeBagDE70
|
|||||||
Notes = "",
|
Notes = "",
|
||||||
OtherError = 0,
|
OtherError = 0,
|
||||||
};
|
};
|
||||||
InitUsers();
|
bInitUser=InitUsers();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -69,7 +68,7 @@ namespace SafeBagDE70
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InitUsers()
|
private static bool InitUsers()
|
||||||
{
|
{
|
||||||
int retryCount = 0;
|
int retryCount = 0;
|
||||||
int maxRetries = 20; // Max retries before giving up
|
int maxRetries = 20; // Max retries before giving up
|
||||||
@@ -97,6 +96,8 @@ namespace SafeBagDE70
|
|||||||
}
|
}
|
||||||
CurrentCustomerAccount = customerAccounts[0];
|
CurrentCustomerAccount = customerAccounts[0];
|
||||||
Log.Information("InitUsers thành công");
|
Log.Information("InitUsers thành công");
|
||||||
|
bInitUser = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -116,6 +117,7 @@ namespace SafeBagDE70
|
|||||||
Thread.Sleep(delay);
|
Thread.Sleep(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return bInitUser;
|
||||||
}
|
}
|
||||||
public static CDMSTATE? CDMSTATE = null;
|
public static CDMSTATE? CDMSTATE = null;
|
||||||
private static DateTime CutOffTime = new DateTime(1, 1, 1, 12, 0, 0); // 12:00 noon as cut-off time
|
private static DateTime CutOffTime = new DateTime(1, 1, 1, 12, 0, 0); // 12:00 noon as cut-off time
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace SafeBagDE70
|
|||||||
int countTimer = 0;
|
int countTimer = 0;
|
||||||
CCmdRsp cCmdRsp = null;
|
CCmdRsp cCmdRsp = null;
|
||||||
bool bInitialized = false;
|
bool bInitialized = false;
|
||||||
bool bOpenPort = false;
|
bool bOpenPort = true;
|
||||||
bool bIsMaintain = false;
|
bool bIsMaintain = false;
|
||||||
MainWindow mainWindow = null;
|
MainWindow mainWindow = null;
|
||||||
Thread thread = null;
|
Thread thread = null;
|
||||||
|
|||||||
+35
-18
@@ -47,27 +47,44 @@ namespace SafeBagDE70
|
|||||||
|
|
||||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
AppData.Init();
|
|
||||||
if (_welcomeUC == null) _welcomeUC = new WelcomeUC();
|
if (_welcomeUC == null) _welcomeUC = new WelcomeUC();
|
||||||
if (_collectionUC == null) _collectionUC = new CollectionUC();
|
|
||||||
if (_informationUC == null) _informationUC = new InformationUC();
|
|
||||||
if (_errorUC == null) _errorUC = new ErrorUC();
|
|
||||||
if (_depositUC == null) _depositUC = new DepositSMUCv2();
|
|
||||||
if (_timeoutUC == null) _timeoutUC = new TimeoutUC();
|
|
||||||
if (_maintainanceUC == null) _maintainanceUC = new MaintainanceUC();
|
|
||||||
if (_endSessionUC == null) _endSessionUC = new EndSessionUC();
|
|
||||||
|
|
||||||
|
|
||||||
gridMain.Children.Add(_welcomeUC);
|
gridMain.Children.Add(_welcomeUC);
|
||||||
gridMain.Children.Add(_depositUC);
|
Task.Run(() =>
|
||||||
gridMain.Children.Add(_collectionUC);
|
{
|
||||||
gridMain.Children.Add(_informationUC);
|
AppData.Init();
|
||||||
gridMain.Children.Add(_errorUC);
|
Dispatcher.Invoke(() =>
|
||||||
gridMain.Children.Add(_timeoutUC);
|
{
|
||||||
gridMain.Children.Add(_maintainanceUC);
|
if (AppData.bInitUser)
|
||||||
gridMain.Children.Add(_endSessionUC);
|
{
|
||||||
|
_welcomeUC.ShowLogin();
|
||||||
|
if (_collectionUC == null) _collectionUC = new CollectionUC();
|
||||||
|
if (_informationUC == null) _informationUC = new InformationUC();
|
||||||
|
if (_errorUC == null) _errorUC = new ErrorUC();
|
||||||
|
if (_depositUC == null) _depositUC = new DepositSMUCv2();
|
||||||
|
if (_timeoutUC == null) _timeoutUC = new TimeoutUC();
|
||||||
|
if (_maintainanceUC == null) _maintainanceUC = new MaintainanceUC();
|
||||||
|
if (_endSessionUC == null) _endSessionUC = new EndSessionUC();
|
||||||
|
|
||||||
ShowWelcomeScreen();
|
|
||||||
|
|
||||||
|
gridMain.Children.Add(_depositUC);
|
||||||
|
gridMain.Children.Add(_collectionUC);
|
||||||
|
gridMain.Children.Add(_informationUC);
|
||||||
|
gridMain.Children.Add(_errorUC);
|
||||||
|
gridMain.Children.Add(_timeoutUC);
|
||||||
|
gridMain.Children.Add(_maintainanceUC);
|
||||||
|
gridMain.Children.Add(_endSessionUC);
|
||||||
|
|
||||||
|
ShowWelcomeScreen();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_welcomeUC.ShowInfor("KHÔNG TẢI ĐƯỢC DANH SÁCH CỬA HÀNG");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
//ShowDepositScreen();
|
//ShowDepositScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+48
-42
@@ -8,53 +8,59 @@
|
|||||||
x:Name="ucWelcome"
|
x:Name="ucWelcome"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid x:Name="gridMain" Visibility="Collapsed">
|
||||||
<RowDefinition Height="4*"/>
|
|
||||||
<RowDefinition Height="4*"/>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<!-- Top Section -->
|
|
||||||
<StackPanel Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0">
|
|
||||||
<Image Source="icon/logo.ico" Width="200" Height="200" Margin="0,10,0,10" Stretch="UniformToFill"/>
|
|
||||||
<TextBlock Text="Xin chào! Hãy lựa chọn hình thức đăng nhập để tiếp tục" FontSize="24" FontWeight="Bold" TextAlignment="Center"/>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<!-- Middle Section -->
|
|
||||||
<Grid Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="4*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="4*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<!-- Top Section -->
|
||||||
<ColumnDefinition Width="*"/>
|
<StackPanel Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0">
|
||||||
<ColumnDefinition Width="Auto"/>
|
<Image Source="icon/logo.ico" Width="200" Height="200" Margin="0,10,0,10" Stretch="UniformToFill"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<TextBlock Text="Xin chào! Hãy lựa chọn hình thức đăng nhập để tiếp tục" FontSize="24" FontWeight="Bold" TextAlignment="Center"/>
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<Button hc:IconElement.Geometry="{StaticResource FullScreenGeometry}" Grid.Column="0" Grid.Row="0" x:Name="btnQRCodeLogin" Content="QR CODE" Width="200" Height="100" Margin="0,0,10,0" FontSize="20" FontWeight="Bold" Click="btnQRCodeLogin_Click"/>
|
|
||||||
<Button Grid.Column="2" Grid.Row="0" x:Name="btnPinCodeLogin" Content="PIN CODE" Width="200" Height="100" Margin="10,0,0,0" Click="PinCodeButton_Click" FontSize="20" FontWeight="Bold"/>
|
|
||||||
|
|
||||||
<StackPanel Grid.ColumnSpan="3" Grid.Row="1" HorizontalAlignment="Center" Visibility="Collapsed" x:Name="PinCodePanel">
|
|
||||||
<TextBox x:Name="PinCodeBox" Width="300" Height="60" FontSize="20" HorizontalContentAlignment="Center" Margin="0,10,0,0"/>
|
|
||||||
<!--<TextBlock Text="Quên mã PIN?" Foreground="Blue" TextDecorations="Underline" Cursor="Hand" Margin="0,5,0,0" MouseLeftButtonUp="ForgotPin_Click"/>-->
|
|
||||||
<Button Content="Đăng nhập" Width="200" Height="40" Margin="0,10,0,0" Click="LoginButton_Click"/>
|
|
||||||
<Label x:Name="lblPincodeError" Background="Transparent" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red" />
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Grid.ColumnSpan="3" Grid.Row="1" HorizontalAlignment="Center" Visibility="Collapsed" x:Name="QrCodePanel">
|
|
||||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Đưa QR Code của bạn vào đầu đọc" FontSize="20"/>
|
|
||||||
<hc:LoadingCircle Background="Transparent" VerticalAlignment="Bottom" Width="50" Height="50" Margin="10"/>
|
|
||||||
<Label x:Name="lblQRcodeError" Background="Transparent" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Middle Section -->
|
||||||
|
<Grid Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button hc:IconElement.Geometry="{StaticResource FullScreenGeometry}" Grid.Column="0" Grid.Row="0" x:Name="btnQRCodeLogin" Content="QR CODE" Width="200" Height="100" Margin="0,0,10,0" FontSize="20" FontWeight="Bold" Click="btnQRCodeLogin_Click"/>
|
||||||
|
<Button Grid.Column="2" Grid.Row="0" x:Name="btnPinCodeLogin" Content="PIN CODE" Width="200" Height="100" Margin="10,0,0,0" Click="PinCodeButton_Click" FontSize="20" FontWeight="Bold"/>
|
||||||
|
|
||||||
|
<StackPanel Grid.ColumnSpan="3" Grid.Row="1" HorizontalAlignment="Center" Visibility="Collapsed" x:Name="PinCodePanel">
|
||||||
|
<TextBox x:Name="PinCodeBox" Width="300" Height="60" FontSize="20" HorizontalContentAlignment="Center" Margin="0,10,0,0"/>
|
||||||
|
<!--<TextBlock Text="Quên mã PIN?" Foreground="Blue" TextDecorations="Underline" Cursor="Hand" Margin="0,5,0,0" MouseLeftButtonUp="ForgotPin_Click"/>-->
|
||||||
|
<Button Content="Đăng nhập" Width="200" Height="40" Margin="0,10,0,0" Click="LoginButton_Click"/>
|
||||||
|
<Label x:Name="lblPincodeError" Background="Transparent" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.ColumnSpan="3" Grid.Row="1" HorizontalAlignment="Center" Visibility="Collapsed" x:Name="QrCodePanel">
|
||||||
|
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Đưa QR Code của bạn vào đầu đọc" FontSize="20"/>
|
||||||
|
<hc:LoadingCircle Background="Transparent" VerticalAlignment="Bottom" Width="50" Height="50" Margin="10"/>
|
||||||
|
<Label x:Name="lblQRcodeError" Background="Transparent" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- Bottom Section -->
|
||||||
|
<StackPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
<TextBlock x:Name="txtVersion" Text="TRỢ GIÚP" Foreground="Blue" TextDecorations="Underline" Cursor="Hand" MouseLeftButtonUp="Help_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<Grid x:Name="gridInfor">
|
||||||
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
<TextBlock x:Name="txtInfor" Text="ĐANG KHỞI TẠO, VUI LÒNG ĐỢI" Foreground="Blue" FontSize="24" />
|
||||||
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Bottom Section -->
|
|
||||||
<StackPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
||||||
<TextBlock x:Name="txtVersion" Text="TRỢ GIÚP" Foreground="Blue" TextDecorations="Underline" Cursor="Hand" MouseLeftButtonUp="Help_Click"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
+13
-1
@@ -4,6 +4,7 @@ using Serilog;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -50,7 +51,18 @@ namespace SafeBagDE70
|
|||||||
PinCodeBox.Text = "";
|
PinCodeBox.Text = "";
|
||||||
QrCodePanel.Visibility = Visibility.Collapsed;
|
QrCodePanel.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
public void ShowLogin()
|
||||||
|
{
|
||||||
|
gridInfor.Visibility = Visibility.Collapsed;
|
||||||
|
gridMain.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
public void ShowInfor(string strMessage)
|
||||||
|
{
|
||||||
|
gridInfor.Visibility = Visibility.Visible;
|
||||||
|
gridMain.Visibility = Visibility.Collapsed;
|
||||||
|
txtInfor.Text = strMessage;
|
||||||
|
txtInfor.Foreground = new SolidColorBrush(Colors.DarkRed);
|
||||||
|
}
|
||||||
private void LoginButton_Click(object sender, RoutedEventArgs e)
|
private void LoginButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@
|
|||||||
{
|
{
|
||||||
"Name": "File",
|
"Name": "File",
|
||||||
"Args": {
|
"Args": {
|
||||||
"path": "logs\\log_.txt",
|
"path": "D:\\logs\\log_.txt",
|
||||||
"rollingInterval": "Day"
|
"rollingInterval": "Day"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"SensorPort": "COM3"
|
"SensorPort": "COM3"
|
||||||
},
|
},
|
||||||
"CDM": {
|
"CDM": {
|
||||||
"MaxNotes": 300
|
"MaxNotes": 9999
|
||||||
},
|
},
|
||||||
"Device": {
|
"Device": {
|
||||||
"BaseURL": "http://203.171.20.94:9103/Safebag/",
|
"BaseURL": "http://203.171.20.94:9103/Safebag/",
|
||||||
|
|||||||
Reference in New Issue
Block a user