StatusBar - Check file engine.bat exist

This commit is contained in:
DucDangAnh 2020-07-06 09:41:54 +07:00
parent b441c2d70a
commit 3d08edea71
2 changed files with 12 additions and 4 deletions

View File

@ -13,7 +13,6 @@ namespace AIParkingApplication
private StatusBar statusBar;
private Statistic statistic;
public AIParkingApplicationForm()
{
InitializeComponent();

View File

@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Threading;
using System.Windows.Forms;
@ -11,6 +12,7 @@ namespace AIParkingApplication
private string webServerIP;
private string doorAccessControlDeviceIP;
private TimeSpan updateInterval;
private const string engineFilePath = @"\engine.bat";
public StatusBar(string webServerIP, string doorAccessControlDeviceIP, TimeSpan updateInterval)
{
@ -39,11 +41,18 @@ namespace AIParkingApplication
if (Process.GetProcessesByName("tmux").Length == 0)
{
string engineBatFilePath = Application.StartupPath + @"\engine.bat";
if (File.Exists(engineFilePath))
{
string engineBatFilePath = Application.StartupPath + engineFilePath;
Util.ExecuteCommand(engineBatFilePath);
lblEngineStatus.UpdateLabel("DỪNG HOẠT ĐỘNG", Color.Red);
}
else
{
lblEngineStatus.UpdateLabel("KHÔNG TÌM THẤY FILE", Color.Red);
}
}
else
{
lblEngineStatus.UpdateLabel("ĐANG HOẠT ĐỘNG", Color.Green);
}