cập nhật trạng thái máy in

cập nhật trạng thái DE70
This commit is contained in:
Nguyen Dinh Thuan
2024-09-17 21:59:55 +07:00
parent 47d2bc19c9
commit 2275b51a3f
4 changed files with 91 additions and 50 deletions
+13 -6
View File
@@ -1,5 +1,6 @@
using Custom.CuCustomWndAPI;
using HandyControl.Data;
using Microsoft.IdentityModel.Abstractions;
using SafeBagDE70.API;
using Serilog;
using System;
@@ -28,9 +29,9 @@ namespace SafeBagDE70.Services
}
catch (Exception ex)
{
Log.Information("[PRINTER] Không thể khởi tạo máy in");
Log.Fatal(ex,"[PRINTER] Không thể khởi tạo máy in");
AppData.DeviceStatus.PrinterStatus = 3;
AppData.DeviceStatus.PrinterStatus = (int)PrinterStatusCode.ERROR;
AppData.DeviceStatus.Description = "[PRINTER] Không thể khởi tạo máy in";
APIModels.SendEvent(AppData.DeviceStatus);
}
@@ -38,13 +39,19 @@ namespace SafeBagDE70.Services
public PrinterStatus? GetStatus()
{
if(dev!=null)
try
{
var status = dev.GetPrinterFullStatus();
return status;
if (dev != null)
{
var status = dev.GetPrinterFullStatus();
return status;
}
}
catch(Exception ex)
{
Log.Fatal(ex, "Get Printer Status");
}
return null;
}
public bool IsNearPaperOut()
{