fix lỗi báo máy in gần hết giấy còn 20 lần in
This commit is contained in:
@@ -206,6 +206,7 @@ namespace SafeBagDE70
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
// Release the mutex when the application is closed
|
||||
AppData.UpdateDeviceStatusToFile();
|
||||
mutex?.ReleaseMutex();
|
||||
base.OnExit(e);
|
||||
}
|
||||
|
||||
@@ -550,13 +550,10 @@ namespace SafeBagDE70
|
||||
try
|
||||
{
|
||||
lock (deviceStatusFileName)
|
||||
{
|
||||
if (File.Exists(deviceStatusFileName))
|
||||
{
|
||||
var fileContent = JsonConvert.SerializeObject(DeviceStatusFile);
|
||||
File.WriteAllText(deviceStatusFileName, fileContent);
|
||||
}
|
||||
}
|
||||
Log.Information("UpdatePrinterStatusFromFile success");
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -448,10 +448,14 @@ namespace SafeBagDE70
|
||||
private void GetPrinterStatus()
|
||||
{
|
||||
var status = printerManager.GetStatus();
|
||||
|
||||
var strPrinterMessage = "";
|
||||
|
||||
if (status != null)
|
||||
{
|
||||
if (status.StsNOPAPER|| AppData.IsStopPrinting())
|
||||
bool StsNOPAPER = status.StsNOPAPER;
|
||||
bool StsNEARENDPAP = status.StsNEARENDPAP;
|
||||
if (StsNOPAPER || (StsNEARENDPAP && AppData.IsStopPrinting()))
|
||||
{
|
||||
AppData.DeviceStatus.PrinterStatus = (int)PrinterStatusCode.PAPEROUT;
|
||||
StopTimers();
|
||||
@@ -459,7 +463,7 @@ namespace SafeBagDE70
|
||||
ShowError(strPrinterMessage);
|
||||
AppData.ADMINDEVICESTATUS.PrinterStatus = strPrinterMessage;
|
||||
}
|
||||
else if (status.StsNEARENDPAP)
|
||||
else if (StsNEARENDPAP)
|
||||
{
|
||||
AppData.UpdatePrinterStatus(true);
|
||||
strPrinterMessage = "MÁY IN: GẦN HẾT GIẤY";
|
||||
|
||||
Reference in New Issue
Block a user