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)
|
protected override void OnExit(ExitEventArgs e)
|
||||||
{
|
{
|
||||||
// Release the mutex when the application is closed
|
// Release the mutex when the application is closed
|
||||||
|
AppData.UpdateDeviceStatusToFile();
|
||||||
mutex?.ReleaseMutex();
|
mutex?.ReleaseMutex();
|
||||||
base.OnExit(e);
|
base.OnExit(e);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-5
@@ -551,11 +551,8 @@ namespace SafeBagDE70
|
|||||||
{
|
{
|
||||||
lock (deviceStatusFileName)
|
lock (deviceStatusFileName)
|
||||||
{
|
{
|
||||||
if (File.Exists(deviceStatusFileName))
|
var fileContent = JsonConvert.SerializeObject(DeviceStatusFile);
|
||||||
{
|
File.WriteAllText(deviceStatusFileName, fileContent);
|
||||||
var fileContent = JsonConvert.SerializeObject(DeviceStatusFile);
|
|
||||||
File.WriteAllText(deviceStatusFileName, fileContent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Log.Information("UpdatePrinterStatusFromFile success");
|
Log.Information("UpdatePrinterStatusFromFile success");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -448,10 +448,14 @@ namespace SafeBagDE70
|
|||||||
private void GetPrinterStatus()
|
private void GetPrinterStatus()
|
||||||
{
|
{
|
||||||
var status = printerManager.GetStatus();
|
var status = printerManager.GetStatus();
|
||||||
|
|
||||||
var strPrinterMessage = "";
|
var strPrinterMessage = "";
|
||||||
|
|
||||||
if (status != null)
|
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;
|
AppData.DeviceStatus.PrinterStatus = (int)PrinterStatusCode.PAPEROUT;
|
||||||
StopTimers();
|
StopTimers();
|
||||||
@@ -459,7 +463,7 @@ namespace SafeBagDE70
|
|||||||
ShowError(strPrinterMessage);
|
ShowError(strPrinterMessage);
|
||||||
AppData.ADMINDEVICESTATUS.PrinterStatus = strPrinterMessage;
|
AppData.ADMINDEVICESTATUS.PrinterStatus = strPrinterMessage;
|
||||||
}
|
}
|
||||||
else if (status.StsNEARENDPAP)
|
else if (StsNEARENDPAP)
|
||||||
{
|
{
|
||||||
AppData.UpdatePrinterStatus(true);
|
AppData.UpdatePrinterStatus(true);
|
||||||
strPrinterMessage = "MÁY IN: GẦN HẾT GIẤY";
|
strPrinterMessage = "MÁY IN: GẦN HẾT GIẤY";
|
||||||
|
|||||||
Reference in New Issue
Block a user