wait sql init successfully
This commit is contained in:
+6
-4
@@ -37,12 +37,11 @@ namespace SafeBagDE70
|
||||
public static string BaseURL = "";
|
||||
public static int TenantId = 0;
|
||||
public static DeviceStatus? DeviceStatus = null;
|
||||
|
||||
public static bool bInitUser = false;
|
||||
public static void Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
CDMSTATE = new CDMSTATE();
|
||||
DeviceStatus = new DeviceStatus
|
||||
{
|
||||
@@ -55,7 +54,7 @@ namespace SafeBagDE70
|
||||
Notes = "",
|
||||
OtherError = 0,
|
||||
};
|
||||
InitUsers();
|
||||
bInitUser=InitUsers();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -69,7 +68,7 @@ namespace SafeBagDE70
|
||||
|
||||
}
|
||||
|
||||
private static void InitUsers()
|
||||
private static bool InitUsers()
|
||||
{
|
||||
int retryCount = 0;
|
||||
int maxRetries = 20; // Max retries before giving up
|
||||
@@ -97,6 +96,8 @@ namespace SafeBagDE70
|
||||
}
|
||||
CurrentCustomerAccount = customerAccounts[0];
|
||||
Log.Information("InitUsers thành công");
|
||||
bInitUser = true;
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -116,6 +117,7 @@ namespace SafeBagDE70
|
||||
Thread.Sleep(delay);
|
||||
}
|
||||
}
|
||||
return bInitUser;
|
||||
}
|
||||
public static CDMSTATE? CDMSTATE = null;
|
||||
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;
|
||||
CCmdRsp cCmdRsp = null;
|
||||
bool bInitialized = false;
|
||||
bool bOpenPort = false;
|
||||
bool bOpenPort = true;
|
||||
bool bIsMaintain = false;
|
||||
MainWindow mainWindow = null;
|
||||
Thread thread = null;
|
||||
|
||||
+19
-2
@@ -47,8 +47,17 @@ namespace SafeBagDE70
|
||||
|
||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AppData.Init();
|
||||
|
||||
if (_welcomeUC == null) _welcomeUC = new WelcomeUC();
|
||||
gridMain.Children.Add(_welcomeUC);
|
||||
Task.Run(() =>
|
||||
{
|
||||
AppData.Init();
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (AppData.bInitUser)
|
||||
{
|
||||
_welcomeUC.ShowLogin();
|
||||
if (_collectionUC == null) _collectionUC = new CollectionUC();
|
||||
if (_informationUC == null) _informationUC = new InformationUC();
|
||||
if (_errorUC == null) _errorUC = new ErrorUC();
|
||||
@@ -58,7 +67,7 @@ namespace SafeBagDE70
|
||||
if (_endSessionUC == null) _endSessionUC = new EndSessionUC();
|
||||
|
||||
|
||||
gridMain.Children.Add(_welcomeUC);
|
||||
|
||||
gridMain.Children.Add(_depositUC);
|
||||
gridMain.Children.Add(_collectionUC);
|
||||
gridMain.Children.Add(_informationUC);
|
||||
@@ -68,6 +77,14 @@ namespace SafeBagDE70
|
||||
gridMain.Children.Add(_endSessionUC);
|
||||
|
||||
ShowWelcomeScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
_welcomeUC.ShowInfor("KHÔNG TẢI ĐƯỢC DANH SÁCH CỬA HÀNG");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
//ShowDepositScreen();
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -8,12 +8,12 @@
|
||||
x:Name="ucWelcome"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid x:Name="gridMain" Visibility="Collapsed">
|
||||
<Grid.RowDefinitions>
|
||||
<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"/>
|
||||
@@ -56,5 +56,11 @@
|
||||
<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>
|
||||
|
||||
</UserControl>
|
||||
|
||||
+13
-1
@@ -4,6 +4,7 @@ using Serilog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@@ -50,7 +51,18 @@ namespace SafeBagDE70
|
||||
PinCodeBox.Text = "";
|
||||
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)
|
||||
{
|
||||
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "logs\\log_.txt",
|
||||
"path": "D:\\logs\\log_.txt",
|
||||
"rollingInterval": "Day"
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
"SensorPort": "COM3"
|
||||
},
|
||||
"CDM": {
|
||||
"MaxNotes": 300
|
||||
"MaxNotes": 9999
|
||||
},
|
||||
"Device": {
|
||||
"BaseURL": "http://203.171.20.94:9103/Safebag/",
|
||||
|
||||
Reference in New Issue
Block a user