App.config - add USE_PRINTER key. LaneOut - add ReadUsePrinterConfig
This commit is contained in:
parent
7c03df5229
commit
2c60eebda1
|
@ -6,6 +6,7 @@
|
|||
<add key="DEFAULT_PASSWORD" value="123456a@" />
|
||||
<add key="CURRENT_LANE_SETTING" value="IN-OUT" />
|
||||
<add key="AUTO_LOGIN" value="false" />
|
||||
<add key="USE_PRINTER" value="false" />
|
||||
</appSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Configuration;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -24,6 +25,7 @@ namespace AIParkingApplication
|
|||
private ApiController apiController;
|
||||
private Printer printer;
|
||||
private Logger appLogger;
|
||||
private bool isUsePrinter;
|
||||
|
||||
public LaneOut(int doorId,
|
||||
string cameraId,
|
||||
|
@ -52,6 +54,7 @@ namespace AIParkingApplication
|
|||
this.doorControlAccess = doorControlAccess;
|
||||
printer = new Printer(appLogger);
|
||||
plateProcessor = new PlateProcessor(engineApiController, this.isSupportSquarePlate, this.isSupportLongPlate);
|
||||
ReadUsePrinterConfig();
|
||||
}
|
||||
|
||||
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
|
||||
|
@ -121,7 +124,8 @@ namespace AIParkingApplication
|
|||
OpenDoor(doorId);
|
||||
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | biển số: {result.PlateString} | Đã mở cửa");
|
||||
}
|
||||
if (false)
|
||||
|
||||
if (isUsePrinter)
|
||||
{
|
||||
PrinterData printerData = new PrinterData
|
||||
{
|
||||
|
@ -140,6 +144,19 @@ namespace AIParkingApplication
|
|||
}
|
||||
}
|
||||
|
||||
private void ReadUsePrinterConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool.TryParse(ConfigurationManager.AppSettings["USE_PRINTER"], out isUsePrinter);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Util.AddOrUpdateAppSettings("USE_PRINTER", "false");
|
||||
appLogger.Log(LogLevel.Error, $"Không thể đọc cấu hình: USE_PRINTER");
|
||||
}
|
||||
}
|
||||
|
||||
private void PlateCamera_OnOpenVideoStreamFailed(Mat videoFrame)
|
||||
{
|
||||
pictureBoxPlateVideo.UpdateImage(videoFrame.ToBitmap());
|
||||
|
|
Loading…
Reference in New Issue
Block a user