Improved, fixed #3

This commit is contained in:
Szymon Porwolik
2019-02-28 22:06:56 +01:00
committed by simpo
parent 2463d4267d
commit 4ff546b105
3 changed files with 31 additions and 12 deletions

View File

@@ -58,6 +58,7 @@
this.openFileDialog_SRS = new System.Windows.Forms.OpenFileDialog();
this.openFileDialog_LotATC = new System.Windows.Forms.OpenFileDialog();
this.tim_10000ms = new System.Windows.Forms.Timer(this.components);
this.tim_200ms = new System.Windows.Forms.Timer(this.components);
this.con_GroupBox_1.SuspendLayout();
this.con_GroupBox_2.SuspendLayout();
this.con_GroupBox_3.SuspendLayout();
@@ -321,6 +322,10 @@
this.tim_10000ms.Interval = 30000;
this.tim_10000ms.Tick += new System.EventHandler(this.tim_10000ms_Tick);
//
// tim_200ms
//
this.tim_200ms.Tick += new System.EventHandler(this.tim_200ms_Tick);
//
// form_Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -383,6 +388,7 @@
private System.Windows.Forms.Timer tim_10000ms;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox con_txt_mysql_port;
private System.Windows.Forms.Timer tim_200ms;
}
}

View File

@@ -20,7 +20,7 @@ namespace Perun_v1
public Thread thread_UDPListener; // Seperate thread for UDP
public class_UDPListener UDPListener; // Helper class for UDP comunication
public string[] LogHistory = new string[10]; // Log history for GUI
public string[] SendBuffer = new string[10]; // Mysql send buffer
public string[] SendBuffer = new string[100]; // Mysql send buffer
public bool LetMeOut = false; // Helper to handle system tray
public string MySql_connStr; // MySQL connection string
public string publishVersion = "DEBUG"; // Helper for pulling version definition
@@ -182,9 +182,13 @@ namespace Perun_v1
// Add to mySQL send buffer and rotate
for (int i = 0; i < SendBuffer.Length - 1; i++)
{
SendBuffer[i] = SendBuffer[i + 1];
if (SendBuffer[i]==null)
{
SendBuffer[i] = received_data;
break;
}
}
SendBuffer[9] = received_data;
}
}
@@ -267,6 +271,7 @@ namespace Perun_v1
// Start timmers
tim_1000ms.Enabled = true;
tim_10000ms.Enabled = true;
tim_200ms.Enabled = true;
}
@@ -292,6 +297,7 @@ namespace Perun_v1
// Stop timmers
tim_1000ms.Enabled = false;
tim_10000ms.Enabled = false;
tim_200ms.Enabled = false;
}
private void timer1_Tick(object sender, EventArgs e)
@@ -307,15 +313,6 @@ namespace Perun_v1
}
}
// Send buffer to MySQL
for (int i = 0; i < SendBuffer.Length - 1; i++)
{
if (SendBuffer[i] != null)
{
SendToMySql(SendBuffer[i]);
SendBuffer[i] = null;
}
}
}
private void con_lab_github_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@@ -510,5 +507,18 @@ namespace Perun_v1
SendToMySql(strLotATCJson);
}
private void tim_200ms_Tick(object sender, EventArgs e)
{
// Send buffer to MySQL
for (int i = 0; i < SendBuffer.Length - 1; i++)
{
if (SendBuffer[i] != null)
{
SendToMySql(SendBuffer[i]);
SendBuffer[i] = null;
}
}
}
}
}

View File

@@ -416,6 +416,9 @@
<metadata name="tim_10000ms.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>563, 19</value>
</metadata>
<metadata name="tim_200ms.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>687, 19</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAQD8AAAEAIAAgQQAAFgAAACgAAABAAAAAfgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA