diff --git a/AiQ_GUI.cs b/AiQ_GUI.cs index 95d0015..4d23046 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 @@ -203,7 +204,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); @@ -244,7 +245,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 @@ -276,7 +277,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"); } @@ -299,7 +300,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); @@ -310,12 +311,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(); @@ -356,7 +357,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