update trạng thái trang sau
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
<!-- Top Bar -->
|
<!-- Top Bar -->
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<!-- Main Content Area -->
|
<!-- Main Content Area -->
|
||||||
<RowDefinition Height="150"/>
|
<RowDefinition Height="100"/>
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -84,12 +84,11 @@
|
|||||||
<ContentControl Grid.Row="1" Grid.Column="1" x:Name="MainContentControl" Margin="10"/>
|
<ContentControl Grid.Row="1" Grid.Column="1" x:Name="MainContentControl" Margin="10"/>
|
||||||
|
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<StackPanel Grid.Row="2" Grid.ColumnSpan="2" Orientation="Horizontal" Background="LightGray">
|
<StackPanel Grid.Row="2" Grid.ColumnSpan="2" Background="LightGray">
|
||||||
<TextBlock Text="Admin Panel" VerticalAlignment="Center" Margin="10" Foreground="White" FontSize="14"/>
|
<TextBlock x:Name="lblPrinterStatus" Text="{Binding PrinterStatus}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,10,0" Foreground="Red" FontSize="16"/>
|
||||||
<TextBlock x:Name="lblCDMStatus" Text="{Binding CDMStatus}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Foreground="Red" FontSize="20"/>
|
<TextBlock x:Name="lblCDMStatus" Text="{Binding CDMStatus}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,10,0" Foreground="Red" FontSize="16"/>
|
||||||
<TextBlock x:Name="lblPrinterStatus" Text="{Binding PrinterStatus}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Foreground="Red" FontSize="20"/>
|
<TextBlock x:Name="lblSensorStatus" Text="{Binding SensorStatus}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,10,0" Foreground="Red" FontSize="16"/>
|
||||||
<TextBlock x:Name="lblSensorStatus" Text="{Binding SensorStatus}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Foreground="Red" FontSize="20"/>
|
<TextBlock x:Name="lblDeviceStatus" Text="{Binding DeviceStatus}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,10,0" Foreground="Red" FontSize="16"/>
|
||||||
<TextBlock x:Name="lblDeviceStatus" Text="{Binding DeviceStatus}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0" Foreground="Red" FontSize="20"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</hc:Window>
|
</hc:Window>
|
||||||
|
|||||||
+2
-2
@@ -423,7 +423,7 @@ namespace SafeBagDE70
|
|||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
private string? _PrinterStatus;
|
private string? _PrinterStatus;
|
||||||
public string? Printertatus
|
public string? PrinterStatus
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -435,7 +435,7 @@ namespace SafeBagDE70
|
|||||||
{
|
{
|
||||||
_PrinterStatus = value;
|
_PrinterStatus = value;
|
||||||
|
|
||||||
OnPropertyChanged(nameof(Printertatus));
|
OnPropertyChanged(nameof(PrinterStatus));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-2
@@ -180,6 +180,7 @@ namespace SafeBagDE70
|
|||||||
if (!serialPortSensor.IsOpen)
|
if (!serialPortSensor.IsOpen)
|
||||||
serialPortSensor.Open();
|
serialPortSensor.Open();
|
||||||
}
|
}
|
||||||
|
AppData.ADMINDEVICESTATUS.SensorStatus = "Sensor: OK";
|
||||||
return true;
|
return true;
|
||||||
}catch(Exception ex)
|
}catch(Exception ex)
|
||||||
{
|
{
|
||||||
@@ -187,6 +188,7 @@ namespace SafeBagDE70
|
|||||||
AppData.DeviceStatus.Description = ex.Message;
|
AppData.DeviceStatus.Description = ex.Message;
|
||||||
APIModels.SendEvent(AppData.DeviceStatus);
|
APIModels.SendEvent(AppData.DeviceStatus);
|
||||||
Log.Information(ex, "LỖI KẾT NỐI SENSOR");
|
Log.Information(ex, "LỖI KẾT NỐI SENSOR");
|
||||||
|
AppData.ADMINDEVICESTATUS.SensorStatus = "Sensor: Error";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -214,6 +216,7 @@ namespace SafeBagDE70
|
|||||||
if (!serialPortDE70.IsOpen)
|
if (!serialPortDE70.IsOpen)
|
||||||
serialPortDE70.Open();
|
serialPortDE70.Open();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
@@ -222,6 +225,7 @@ namespace SafeBagDE70
|
|||||||
AppData.DeviceStatus.Description = ex.Message;
|
AppData.DeviceStatus.Description = ex.Message;
|
||||||
APIModels.SendEvent(AppData.DeviceStatus);
|
APIModels.SendEvent(AppData.DeviceStatus);
|
||||||
Log.Information(ex, "LỖI KẾT NỐI CDM");
|
Log.Information(ex, "LỖI KẾT NỐI CDM");
|
||||||
|
AppData.CDMSTATE.CDMStatus = "CDM: Error";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -400,13 +404,18 @@ namespace SafeBagDE70
|
|||||||
StopTimers();
|
StopTimers();
|
||||||
strPrinterMessage = "MÁY IN HẾT GIẤY! ĐỀ NGHỊ THAY GIẤY";
|
strPrinterMessage = "MÁY IN HẾT GIẤY! ĐỀ NGHỊ THAY GIẤY";
|
||||||
ShowError(strPrinterMessage);
|
ShowError(strPrinterMessage);
|
||||||
AppData.ADMINDEVICESTATUS.Printertatus = strPrinterMessage;
|
AppData.ADMINDEVICESTATUS.PrinterStatus = strPrinterMessage;
|
||||||
}
|
}
|
||||||
else if (status.StsNEARENDPAP)
|
else if (status.StsNEARENDPAP)
|
||||||
{
|
{
|
||||||
strPrinterMessage = "MÁY IN GẦN HẾT GIẤY";
|
strPrinterMessage = "MÁY IN GẦN HẾT GIẤY";
|
||||||
AppData.DeviceStatus.PrinterStatus = (int)PrinterStatusCode.NEARPAPEROUT;
|
AppData.DeviceStatus.PrinterStatus = (int)PrinterStatusCode.NEARPAPEROUT;
|
||||||
AppData.ADMINDEVICESTATUS.Printertatus = strPrinterMessage;
|
AppData.ADMINDEVICESTATUS.PrinterStatus = strPrinterMessage;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AppData.ADMINDEVICESTATUS.PrinterStatus = "MÁY IN OK";
|
||||||
|
|
||||||
}
|
}
|
||||||
if (AppData.DeviceStatus.PrinterStatus != prevPrinterStatus)
|
if (AppData.DeviceStatus.PrinterStatus != prevPrinterStatus)
|
||||||
{
|
{
|
||||||
@@ -420,6 +429,10 @@ namespace SafeBagDE70
|
|||||||
AppData.DeviceStatus.DeviceTime = DateTime.Now;
|
AppData.DeviceStatus.DeviceTime = DateTime.Now;
|
||||||
APIModels.SendHealthCheck(AppData.DeviceStatus);
|
APIModels.SendHealthCheck(AppData.DeviceStatus);
|
||||||
}
|
}
|
||||||
|
if(countSensorTimer%5==0)
|
||||||
|
{
|
||||||
|
AppData.ADMINDEVICESTATUS.DeviceStatus = AppData.IsInternetOk == false ? "Kết nối Internet: Không" : "Kết nối Internet: OK";
|
||||||
|
}
|
||||||
if (countSensorTimer % 300 == 0)
|
if (countSensorTimer % 300 == 0)
|
||||||
{
|
{
|
||||||
AppData.ResendData();
|
AppData.ResendData();
|
||||||
|
|||||||
Reference in New Issue
Block a user