From 30bd2fe73cf1d19c5728e5c0504c44aa75646703 Mon Sep 17 00:00:00 2001 From: Bradley Born Date: Tue, 2 Dec 2025 12:59:40 +0000 Subject: [PATCH] AddToAction List colours --- AiQ_GUI.cs | 92 +++++++++++++++++++++------------------ AiQ_GUI_NET_Test.csproj | 3 +- Camera/CameraModules.cs | 14 +++--- Camera/FlexiAPI.cs | 49 +++++++++++---------- Camera/ImageProcessing.cs | 14 +++--- Camera/LED.cs | 2 +- Camera/Licences.cs | 10 ++--- Camera/Router.cs | 12 ++--- Camera/SSH.cs | 12 ++--- GoogleAPI.cs | 12 ++--- Helper.cs | 10 ++--- LDS.cs | 4 +- Logging.cs | 6 ++- Microsoft/Access.cs | 6 +-- Microsoft/Excel.cs | 39 +++++++++-------- Network.cs | 12 ++--- Soak/Selenium.cs | 10 ++--- Soak/SoakTest.cs | 24 +++++----- 18 files changed, 171 insertions(+), 160 deletions(-) diff --git a/AiQ_GUI.cs b/AiQ_GUI.cs index b1dce52..8d14014 100644 --- a/AiQ_GUI.cs +++ b/AiQ_GUI.cs @@ -9,7 +9,8 @@ namespace AiQ_GUI { ERROR, WARNING, - LOG + LOG, + Success } public partial class MainForm : Form @@ -77,7 +78,7 @@ namespace AiQ_GUI if (localDataStore == null) { - AddToActionsList("Could not deserialise LDS.json please help!"); + AddToActionsList("Could not deserialise LDS.json please help!", Level.WARNING); return; } @@ -138,7 +139,7 @@ namespace AiQ_GUI string LEDreply = await FlexiAPI.APIHTTPLED(CamOnTest.IP, LEDPOWER.SAFE); // Set LED's to safe (0x0E) to help with eye safety and trim check. if (!LEDreply.Contains("Power levels set successfully")) - AddToActionsList($"LED level could not be set: {LEDreply}"); + AddToActionsList($"LED level could not be set: {LEDreply}", Level.ERROR); } 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"); @@ -157,7 +158,7 @@ namespace AiQ_GUI string VISCAReply = await FlexiAPI.APIHTTPVISCA(CamOnTest.IP, "8101043903FF", true); // Manual mode to be able to manipulate the SIG settings. if (VISCAReply != "9041FF9051FF") - AddToActionsList("Couldn't set to manual mode"); + AddToActionsList("Couldn't set to manual mode",Level.ERROR); await CameraModules.SetSIG(CbBxShutter, CbBxIris, CbBxGain, CamOnTest.IP); // Set SIG according to the drop downs in settings for a good picture ready for image check await ImageProcessing.ImageCheck(PicBxOV, PicBxIRF2, PicBxIRF16, LblIRImageF2, LblIRImageF16, CamOnTest); // Populates the picture boxes and checks iris changes @@ -200,7 +201,7 @@ namespace AiQ_GUI string LEDreply = await FlexiAPI.APIHTTPLED(CamOnTest.IP, LEDPOWER.MID); // Set LED's to medium (0x30) if (!LEDreply.Contains("Power levels set successfully")) - AddToActionsList($"LED level could not be set: {LEDreply}"); + AddToActionsList($"LED level could not be set: {LEDreply}", Level.ERROR); } await FlexiAPI.SetVaxtorMinMaxPlate(CamOnTest.IP); @@ -241,7 +242,7 @@ namespace AiQ_GUI string LEDreply = await FlexiAPI.APIHTTPLED(CamOnTest.IP, LEDPOWER.MID); // Set LED's to medium (0x30) if (!LEDreply.Contains("Power levels set successfully")) - AddToActionsList($"LED level could not be set: {LEDreply}"); + AddToActionsList($"LED level could not be set: {LEDreply}", Level.ERROR); await CameraModules.FactoryResetModules(CamOnTest.IP); // Reset both modules and double check @@ -273,7 +274,7 @@ namespace AiQ_GUI if (await DisplayQuestion($"Would you like to allocate a serial number to this camera?")) await AllocateSerial(); else if (GoogleAPI.UpdateSpreadSheetRePreTest(CameraAccessInfo.SpreadsheetID, Vers) != "OK") // If rerun might be different values so update SS - AddToActionsList("Failed to write to spreadsheet, please check manually"); + AddToActionsList("Failed to write to spreadsheet, please check manually",Level.WARNING); // else if (Excel.UpdateSpreadSheetPreTest(CameraAccessInfo.SpreadsheetID, Vers, CamOnTest.GetCamDesc(), CamOnTest.Model) != "OK") // AddToActionsList("Failed to write to spreadsheet, please check manually"); } @@ -296,7 +297,7 @@ namespace AiQ_GUI string err = GoogleAPI.UpdateSpreadSheetFinalTest(CameraAccessInfo.SpreadsheetID, DiagsAPI, sshData, CamOnTest.RMANum); if (err != string.Empty) // If there is an error message, display it - AddToActionsList("Failed to write to spreadsheet " + err); + AddToActionsList("Failed to write to spreadsheet " + err, Level.ERROR); // Purge camera of all reads await FlexiAPI.APIHTTPRequest("/api/purge-all", CamOnTest.IP); @@ -307,12 +308,12 @@ namespace AiQ_GUI string[,] GOD_JSON = { { "propGodMode", "false" } }; string IntConf = await FlexiAPI.HTTP_Update("GLOBAL--FlexiApplication", CamOnTest.IP, GOD_JSON); if (!IntConf.Contains("\"propGodMode\": {\"value\": \"false\", \"datatype\": \"boolean\"},")) - AddToActionsList("Could not turn off God mode"); + AddToActionsList("Could not turn off God mode", Level.WARNING); Thread Thr211 = new(async () => { if (!await FlexiAPI.ChangeNetwork211(CamOnTest.IP)) // Change camera IP to 192.168.1.211. Waits for camera to come back. - AddToActionsList("Could not find camera at 192.168.1.211. Please check manually"); + AddToActionsList("Could not find camera at 192.168.1.211. Please check manually", Level.WARNING); }); Thr211.IsBackground = true; Thr211.Start(); @@ -353,7 +354,7 @@ namespace AiQ_GUI else Access.Stats("RMA Final Tests Failed", CamOnTest.Model); - AddToActionsList(ErrMssg); + AddToActionsList(ErrMssg, Level.ERROR); string RedLbls = string.Join(Environment.NewLine, PnlLbls.Controls .OfType