From fcb2f62646eaa718b954d50334c97e568e8230f2 Mon Sep 17 00:00:00 2001 From: szporowolik Date: Sat, 19 Oct 2019 12:26:18 +0200 Subject: [PATCH 1/7] Fixed version displayed in title bar --- 02_Windows_App/Perun_v1/01_Classes/PerunHelper.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/02_Windows_App/Perun_v1/01_Classes/PerunHelper.cs b/02_Windows_App/Perun_v1/01_Classes/PerunHelper.cs index c77dbf2..a8b8395 100644 --- a/02_Windows_App/Perun_v1/01_Classes/PerunHelper.cs +++ b/02_Windows_App/Perun_v1/01_Classes/PerunHelper.cs @@ -1,5 +1,6 @@ // This class gathers all helper functions using System; +using System.Reflection; internal class PerunHelper { @@ -21,6 +22,10 @@ internal class PerunHelper System.Deployment.Application.ApplicationDeployment cd = System.Deployment.Application.ApplicationDeployment.CurrentDeployment; Globals.strPerunVersion = cd.CurrentVersion.ToString(); } + else + { + Globals.strPerunVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } return strBeginning+"v" + Globals.strPerunVersion; } } \ No newline at end of file From 57483ad4c8701f8bc2d867358ff859e05013cf27 Mon Sep 17 00:00:00 2001 From: szporowolik Date: Sat, 19 Oct 2019 12:26:27 +0200 Subject: [PATCH 2/7] v8.1.0 --- 02_Windows_App/Perun_v1/Perun_v1.csproj | 2 +- 02_Windows_App/Perun_v1/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/02_Windows_App/Perun_v1/Perun_v1.csproj b/02_Windows_App/Perun_v1/Perun_v1.csproj index 69b9a78..7b8a114 100644 --- a/02_Windows_App/Perun_v1/Perun_v1.csproj +++ b/02_Windows_App/Perun_v1/Perun_v1.csproj @@ -34,7 +34,7 @@ true Perun.htm 0 - 0.8.0.%2a + 0.8.1.%2a false true true diff --git a/02_Windows_App/Perun_v1/Properties/AssemblyInfo.cs b/02_Windows_App/Perun_v1/Properties/AssemblyInfo.cs index ef8e214..39a3f2a 100644 --- a/02_Windows_App/Perun_v1/Properties/AssemblyInfo.cs +++ b/02_Windows_App/Perun_v1/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ using System.Runtime.InteropServices; // Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki // przy użyciu symbolu „*”, tak jak pokazano poniżej: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.8.0.0")] -[assembly: AssemblyFileVersion("0.8.0.0")] +[assembly: AssemblyVersion("0.8.1.0")] +[assembly: AssemblyFileVersion("0.8.1.0")] [assembly: NeutralResourcesLanguage("en")] From af4bc135da90cc737adbdc1b7e36b32251c5028e Mon Sep 17 00:00:00 2001 From: szporowolik Date: Sat, 19 Oct 2019 12:39:29 +0200 Subject: [PATCH 3/7] Block quit button, while server is connected. --- 02_Windows_App/Perun_v1/02_Forms/form_Main.cs | 2 ++ 1 file changed, 2 insertions(+) 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 8bca802..3f9ecbb 100644 --- a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs +++ b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs @@ -117,6 +117,7 @@ namespace Perun_v1 // Disables controls con_Button_Listen_ON.Enabled = false; con_Button_Listen_OFF.Enabled = true; + con_Button_Quit.Enabled = false; con_txt_mysql_database.Enabled = false; con_txt_mysql_username.Enabled = false; con_txt_mysql_password.Enabled = false; @@ -135,6 +136,7 @@ namespace Perun_v1 // Enables controls con_Button_Listen_ON.Enabled = true; con_Button_Listen_OFF.Enabled = false; + con_Button_Quit.Enabled = true; con_txt_mysql_database.Enabled = true; con_txt_mysql_username.Enabled = true; con_txt_mysql_password.Enabled = true; From 1d6b32872b304758233a532c803ef997105e3714 Mon Sep 17 00:00:00 2001 From: szporowolik Date: Sat, 19 Oct 2019 12:43:13 +0200 Subject: [PATCH 4/7] Configuration change --- 02_Windows_App/Perun_v1/Perun_v1.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/02_Windows_App/Perun_v1/Perun_v1.csproj b/02_Windows_App/Perun_v1/Perun_v1.csproj index 7b8a114..c9a2b6d 100644 --- a/02_Windows_App/Perun_v1/Perun_v1.csproj +++ b/02_Windows_App/Perun_v1/Perun_v1.csproj @@ -49,6 +49,7 @@ DEBUG;TRACE prompt 4 + SecurityRules.ruleset AnyCPU From fb0620d178707d19e94d3dd0036161a5c1ced686 Mon Sep 17 00:00:00 2001 From: szporowolik Date: Sat, 19 Oct 2019 13:13:20 +0200 Subject: [PATCH 5/7] Performance upgrae - history control update only when it's really needed --- 02_Windows_App/Perun_v1/01_Classes/Globals.cs | 2 ++ .../Perun_v1/01_Classes/PerunHelper.cs | 1 + 02_Windows_App/Perun_v1/02_Forms/form_Main.cs | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) 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 } } From 666c3a859f660a12377f61b58410aa9b38904e94 Mon Sep 17 00:00:00 2001 From: szporowolik Date: Sat, 19 Oct 2019 13:22:44 +0200 Subject: [PATCH 6/7] Performance upgrade - status icons reloaded only when really needed --- 02_Windows_App/Perun_v1/01_Classes/Globals.cs | 6 +- 02_Windows_App/Perun_v1/02_Forms/form_Main.cs | 67 +++++++++++-------- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/02_Windows_App/Perun_v1/01_Classes/Globals.cs b/02_Windows_App/Perun_v1/01_Classes/Globals.cs index d1dba87..3b461e0 100644 --- a/02_Windows_App/Perun_v1/01_Classes/Globals.cs +++ b/02_Windows_App/Perun_v1/01_Classes/Globals.cs @@ -7,6 +7,10 @@ internal class Globals 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 = ""; - + + public static bool bdcConnection = false; // Historic db connection status + public static bool btcpcServer = false; // Historic tcp connection status + public static bool bSRSStatus = false; // Historic srs connection status + public static bool bLotATCStatus = false; // Historic lotatc connection status } 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 f7e0d5a..076329a 100644 --- a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs +++ b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs @@ -367,38 +367,51 @@ namespace Perun_v1 } // Update status icons at main form - if (dcConnection.bStatus) - { - con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_db"); - } else - { - con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); + if (dcConnection.bStatus != Globals.bdcConnection) { + if (dcConnection.bStatus) + { + con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_db"); + } else + { + con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); + } + Globals.bdcConnection = dcConnection.bStatus; } - if (tcpcServer.bStatus) - { - con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_game"); + + if (tcpcServer.bStatus != Globals.btcpcServer) { + if (tcpcServer.bStatus) + { + con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_game"); + } + else + { + con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); + } + Globals.btcpcServer = tcpcServer.bStatus; } - else - { - con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); + if (bSRSStatus != Globals.bSRSStatus) { + if (bSRSStatus) + { + con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_srs"); + } + else + {; + con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); + } + Globals.bSRSStatus = bSRSStatus; } - if (bSRSStatus) + if (bLotATCStatus != Globals.bLotATCStatus) { - con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_srs"); + if (bLotATCStatus) + { + con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_lotatc"); + } + else + { + con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); + } + Globals.bLotATCStatus = bLotATCStatus; } - else - { - con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); - } - if (bLotATCStatus) - { - con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_lotatc"); - } - else - { - con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error"); - } - } From a0742c8c433353b10939ab446dc0c42bc741340f Mon Sep 17 00:00:00 2001 From: szporowolik Date: Sat, 19 Oct 2019 13:34:50 +0200 Subject: [PATCH 7/7] Performance upgrade - icons reloading will not affect performance --- 02_Windows_App/Perun_v1/01_Classes/Globals.cs | 1 + .../Perun_v1/02_Forms/form_Main.Designer.cs | 56 +++++++++++++++++-- 02_Windows_App/Perun_v1/02_Forms/form_Main.cs | 23 ++++++-- 3 files changed, 70 insertions(+), 10 deletions(-) diff --git a/02_Windows_App/Perun_v1/01_Classes/Globals.cs b/02_Windows_App/Perun_v1/01_Classes/Globals.cs index 3b461e0..27b4bac 100644 --- a/02_Windows_App/Perun_v1/01_Classes/Globals.cs +++ b/02_Windows_App/Perun_v1/01_Classes/Globals.cs @@ -8,6 +8,7 @@ internal class Globals public static bool bLogHistoryUpdate = true; // Mark if log control require update public static string strPerunTitleText = ""; + public static bool bStatusIconsForce = true; // Force icons reload public static bool bdcConnection = false; // Historic db connection status public static bool btcpcServer = false; // Historic tcp connection status public static bool bSRSStatus = false; // Historic srs connection status diff --git a/02_Windows_App/Perun_v1/02_Forms/form_Main.Designer.cs b/02_Windows_App/Perun_v1/02_Forms/form_Main.Designer.cs index 36951ba..fc3a6bf 100644 --- a/02_Windows_App/Perun_v1/02_Forms/form_Main.Designer.cs +++ b/02_Windows_App/Perun_v1/02_Forms/form_Main.Designer.cs @@ -69,6 +69,10 @@ this.con_img_srs = new System.Windows.Forms.PictureBox(); this.con_img_dcs = new System.Windows.Forms.PictureBox(); this.con_img_db = new System.Windows.Forms.PictureBox(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); this.con_GroupBox_1.SuspendLayout(); this.con_GroupBox_2.SuspendLayout(); this.con_GroupBox_3.SuspendLayout(); @@ -384,7 +388,7 @@ // // con_img_lotATC // - this.con_img_lotATC.Location = new System.Drawing.Point(307, 335); + this.con_img_lotATC.Location = new System.Drawing.Point(292, 335); this.con_img_lotATC.Name = "con_img_lotATC"; this.con_img_lotATC.Size = new System.Drawing.Size(29, 28); this.con_img_lotATC.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -393,7 +397,7 @@ // // con_img_srs // - this.con_img_srs.Location = new System.Drawing.Point(272, 335); + this.con_img_srs.Location = new System.Drawing.Point(208, 335); this.con_img_srs.Name = "con_img_srs"; this.con_img_srs.Size = new System.Drawing.Size(29, 28); this.con_img_srs.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -402,7 +406,7 @@ // // con_img_dcs // - this.con_img_dcs.Location = new System.Drawing.Point(237, 335); + this.con_img_dcs.Location = new System.Drawing.Point(135, 335); this.con_img_dcs.Name = "con_img_dcs"; this.con_img_dcs.Size = new System.Drawing.Size(29, 28); this.con_img_dcs.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -412,18 +416,58 @@ // con_img_db // this.con_img_db.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.con_img_db.Location = new System.Drawing.Point(202, 335); + this.con_img_db.Location = new System.Drawing.Point(69, 335); this.con_img_db.Name = "con_img_db"; this.con_img_db.Size = new System.Drawing.Size(29, 28); this.con_img_db.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.con_img_db.TabIndex = 10; this.con_img_db.TabStop = false; // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(15, 335); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(56, 13); + this.label9.TabIndex = 1; + this.label9.Text = "Database:"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(101, 335); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(38, 13); + this.label10.TabIndex = 14; + this.label10.Text = "Game:"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(170, 335); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(32, 13); + this.label11.TabIndex = 15; + this.label11.Text = "SRS:"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(243, 335); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(46, 13); + this.label12.TabIndex = 16; + this.label12.Text = "LotATC:"; + // // form_Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(349, 604); + this.Controls.Add(this.label12); + this.Controls.Add(this.label11); + this.Controls.Add(this.label10); + this.Controls.Add(this.label9); this.Controls.Add(this.con_img_lotATC); this.Controls.Add(this.con_img_srs); this.Controls.Add(this.con_img_dcs); @@ -503,6 +547,10 @@ private System.Windows.Forms.PictureBox con_img_dcs; private System.Windows.Forms.PictureBox con_img_srs; private System.Windows.Forms.PictureBox con_img_lotATC; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label12; } } 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 076329a..cbcd6ea 100644 --- a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs +++ b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs @@ -166,6 +166,9 @@ namespace Perun_v1 // Prepare connection string dcConnection.strMySQLConnectionString = "server=" + con_txt_mysql_server.Text + ";user=" + con_txt_mysql_username.Text + ";database=" + con_txt_mysql_database.Text + ";port=" + con_txt_mysql_port.Text + ";password=" + con_txt_mysql_password.Text; + // Force icons update + Globals.bStatusIconsForce = true; + // Start timmers tim_200ms.Enabled = true; tim_1000ms.Enabled = true; @@ -221,7 +224,14 @@ namespace Perun_v1 // Set title bar this.Text = Globals.strPerunTitleText; - } + + // Set helpers for updates + Globals.bLogHistoryUpdate = false; + Globals.bdcConnection = false; + Globals.btcpcServer = false; + Globals.bSRSStatus = false; + Globals.bLotATCStatus = false; + } private void con_lab_github_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { @@ -367,7 +377,7 @@ namespace Perun_v1 } // Update status icons at main form - if (dcConnection.bStatus != Globals.bdcConnection) { + if ((dcConnection.bStatus != Globals.bdcConnection) || Globals.bStatusIconsForce) { if (dcConnection.bStatus) { con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_db"); @@ -378,7 +388,7 @@ namespace Perun_v1 Globals.bdcConnection = dcConnection.bStatus; } - if (tcpcServer.bStatus != Globals.btcpcServer) { + if ((tcpcServer.bStatus != Globals.btcpcServer) || Globals.bStatusIconsForce) { if (tcpcServer.bStatus) { con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_game"); @@ -389,7 +399,7 @@ namespace Perun_v1 } Globals.btcpcServer = tcpcServer.bStatus; } - if (bSRSStatus != Globals.bSRSStatus) { + if ((bSRSStatus != Globals.bSRSStatus) || Globals.bStatusIconsForce) { if (bSRSStatus) { con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_srs"); @@ -400,7 +410,7 @@ namespace Perun_v1 } Globals.bSRSStatus = bSRSStatus; } - if (bLotATCStatus != Globals.bLotATCStatus) + if ((bLotATCStatus != Globals.bLotATCStatus) || Globals.bStatusIconsForce) { if (bLotATCStatus) { @@ -412,7 +422,7 @@ namespace Perun_v1 } Globals.bLotATCStatus = bLotATCStatus; } - + Globals.bStatusIconsForce = false; } private void tim_10000ms_Tick(object sender, EventArgs e) @@ -517,5 +527,6 @@ namespace Perun_v1 } dcConnection.SendToMySql(strLotATCJson); } + } }