try catch Init printer
Đảo thử tự InitUsers Kiểm tra đầu đọc QR
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Custom.CuCustomWndAPI;
|
||||
using HandyControl.Data;
|
||||
using SafeBagDE70.API;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -23,18 +24,27 @@ namespace SafeBagDE70.Services
|
||||
customWndAPIWrap.InitLibrary();
|
||||
USBDevice[] usbArray = customWndAPIWrap.EnumUSBDevices();
|
||||
dev = customWndAPIWrap.OpenPrinterUSB(usbArray[0]);
|
||||
Log.Information("[PRINTER] Init Printer Successfully");
|
||||
Log.Information("[PRINTER] Khởi tạo thành công");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// System.Windows.MessageBox.Show(ex.ToString());
|
||||
Log.Information("[PRINTER] Không thể khởi tạo máy in");
|
||||
|
||||
AppData.DeviceStatus.PrinterStatus = 3;
|
||||
AppData.DeviceStatus.Description = "[PRINTER] Không thể khởi tạo máy in";
|
||||
APIModels.SendEvent(AppData.DeviceStatus);
|
||||
}
|
||||
}
|
||||
|
||||
public PrinterStatus? GetStatus()
|
||||
{
|
||||
var status = dev.GetPrinterFullStatus();
|
||||
return status;
|
||||
if(dev!=null)
|
||||
{
|
||||
var status = dev.GetPrinterFullStatus();
|
||||
return status;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
public bool IsNearPaperOut()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user