From f4081515be6d06fef6b9d6c65496cb02274422ce Mon Sep 17 00:00:00 2001 From: Bradley Born Date: Fri, 17 Oct 2025 12:06:36 +0100 Subject: [PATCH] This Commit contains all the changes for the new feature for S.L in regards to ExcelStats of the GUI --- AiQ_GUI.cs | 262 +++++++++++++++++++++++++++++++------- AiQ_GUI_NET_Test.csproj | 11 +- Camera/FlexiAPI.cs | 1 + Camera/ImageProcessing.cs | 2 +- FakeCamera/FakeCamera.cs | 6 +- Helper.cs | 23 +++- Microsoft/Access.cs | 5 +- Microsoft/Excel.cs | 45 +++---- Microsoft/StatsExcel.cs | 247 +++++++++++++++++++++++++++++++++++ Microsoft/Windows.cs | 2 + 10 files changed, 511 insertions(+), 93 deletions(-) create mode 100644 Microsoft/StatsExcel.cs diff --git a/AiQ_GUI.cs b/AiQ_GUI.cs index 17cdb98..513bb38 100644 --- a/AiQ_GUI.cs +++ b/AiQ_GUI.cs @@ -1,6 +1,9 @@ -using Newtonsoft.Json; +using AiQ_GUI.Microsoft; +using Newtonsoft.Json; using System.ComponentModel; +using System.Data.OleDb; using System.Diagnostics; +using System.Numerics; using System.Reflection; namespace AiQ_GUI @@ -25,6 +28,8 @@ namespace AiQ_GUI [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public static MainForm? Instance { get; private set; } + // For Access Stats + const string connString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\Shared drives\MAV Production GUI's\AiQ\GUI's\AiQ_Final_Test.accdb;Persist Security Info=False;OLE DB Services=-1;"; public MainForm() { @@ -37,7 +42,7 @@ namespace AiQ_GUI Stopwatch stopwatch = Stopwatch.StartNew(); Task? closeProcessesTask = Windows.CloseProcesses(); // Fire and forget closing other apps - Windows.UpdateFirewall(); + //Windows.UpdateFirewall(); Task UniDataTask = Task.Run(() => Access.ReadUniData()); // Get universal data Task LDSWAIT = Task.Run(() => LDS.GetLDS()); // Get and deserialise LDS.json Task guiVerTask = Task.Run(() => GUIUpdate.FindGUIVersion()); // Get GUI Version @@ -138,12 +143,15 @@ namespace AiQ_GUI AddToActionsList($"LED level could not be set: {LEDreply}"); } else if (!await TestTube.CheckInTestTube(CamOnTest.IP)) // Sets LED's to medium power after checking it is in the test tube + { await TestFailed(BtnStartTest, "Camera not in test tube"); + } Task VisCheck = Helper.VisualCheck(BtnStartTest); if (!await FlexiAPI.ZoomModules("1F40", CamOnTest.IP)) // Zoom to 8000 (1F40h) at the same time. await TestFailed(BtnStartTest, "Could not zoom modules to 8000"); + if (!await FlexiAPI.SetZoomLockOn(CamOnTest.IP)) Helper.RestartApp(); @@ -186,7 +194,9 @@ namespace AiQ_GUI await FlexiAPI.SetTrim(CamOnTest.IP, LblTestTubePing.Text); // Auto trims the cameras, some plates should have been captured in the meantime if (!await FlexiAPI.ZoomModules("0000", CamOnTest.IP)) // Zoom to full wide + { await TestFailed(BtnStartTest, "Could not zoom modules to full wide"); + } await Task.Delay(1000); // Wait to be sure cameras are zoomed out. @@ -214,15 +224,86 @@ namespace AiQ_GUI LED.CheckLEDs(DiagsAPI.LedCurrent, LblLEDI, "mA", CameraAccessInfo.LED_I); // Current this.Refresh(); // Make sure all labels are updated before checking them - + // If there are any actions identified then fail the test. // If any labels are red then fail. Only labels in panel so can foreach on labels not controls if (RhTxBxActions.Text.Length > 2 || PnlLbls.Controls.OfType