diff --git a/02_Windows_App/Perun_v1/01_Classes/Globals.cs b/02_Windows_App/Perun_v1/01_Classes/Globals.cs index 0e65acb..d1dba87 100644 --- a/02_Windows_App/Perun_v1/01_Classes/Globals.cs +++ b/02_Windows_App/Perun_v1/01_Classes/Globals.cs @@ -5,6 +5,8 @@ internal class Globals { public static string strPerunVersion = "DEBUG"; // Helper for pulling version definition public static string[] arrLogHistory = new string[10]; // Log history for GUI + public static bool bLogHistoryUpdate = true; // Mark if log control require update public static string strPerunTitleText = ""; + } diff --git a/02_Windows_App/Perun_v1/01_Classes/PerunHelper.cs b/02_Windows_App/Perun_v1/01_Classes/PerunHelper.cs index a8b8395..faafdd3 100644 --- a/02_Windows_App/Perun_v1/01_Classes/PerunHelper.cs +++ b/02_Windows_App/Perun_v1/01_Classes/PerunHelper.cs @@ -13,6 +13,7 @@ internal class PerunHelper } arrLogHistory[arrLogHistory.Length - 1] = DateTime.Now.ToString("HH:mm:ss") + " > " + strEntryToAdd; // Add entry at the last position + Globals.bLogHistoryUpdate = true; } public static string GetAppVersion(string strBeginning) { diff --git a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs index 3f9ecbb..f7e0d5a 100644 --- a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs +++ b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs @@ -201,7 +201,7 @@ namespace Perun_v1 while (tcpcServer.thrTCPListener.IsAlive) { - Thread.Sleep(100); //ms + Thread.Sleep(10); //ms } form_Main_EnableControls(); // Enable controls @@ -337,13 +337,20 @@ namespace Perun_v1 { // Main timer to sync GUI with background tasks and flush buffers // Refresh Log Window - con_List_Received.Items.Clear(); - foreach (string i in Globals.arrLogHistory) + if (Globals.bLogHistoryUpdate) { - if (i != null) + con_List_Received.Items.Clear(); + foreach (string i in Globals.arrLogHistory) { - con_List_Received.Items.Add(i); + if (i != null) + { + con_List_Received.Items.Add(i); + } } + Globals.bLogHistoryUpdate = false; + } else + { + // Do nothing , control does not require update } }