WIP - main form change

This commit is contained in:
szporowolik
2019-09-12 16:00:53 +02:00
parent 4900ef4888
commit 52ecfda6c5
7 changed files with 112 additions and 285 deletions

View File

@@ -11,37 +11,22 @@ namespace Perun_v1
/// </summary> /// </summary>
// Mutex to block multiple instances // Mutex to block multiple instances
static Mutex mutex = new Mutex(true, "{5a710507-92e9-4664-9b91-918b8b82f107}"); //static Mutex mutex = new Mutex(true, "{5a710507-92e9-4664-9b91-918b8b82f107}");
[STAThread] [STAThread]
static void Main() static void Main()
{ {
// Check if no other instances running // Only instance
if (mutex.WaitOne(TimeSpan.Zero, true)) Application.EnableVisualStyles();
{ Application.SetCompatibleTextRenderingDefault(false);
// Only instance Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
void Application_ApplicationExit(object sender, EventArgs e) void Application_ApplicationExit(object sender, EventArgs e)
{
Properties.Settings.Default.Save(); // We will save settings on exit
}
Application.Run(new form_Main()); // Run main form
mutex.ReleaseMutex(); // Release mutex
}
else
{ {
// Multiple instance - send our Win32 message to make the currently running instance jump to front Properties.Settings.Default.Save(); // We will save settings on exit
NativeMethods.PostMessage(
(IntPtr)NativeMethods.HWND_BROADCAST,
NativeMethods.WM_SHOWME,
IntPtr.Zero,
IntPtr.Zero);
MessageBox.Show("Only one Perun instance is allowed.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
Application.Run(new form_Main()); // Run main form
} }
} }
} }

View File

@@ -29,7 +29,7 @@ internal class TCPController
{ {
// FInish listening // FInish listening
TCPController.boolDone = true; TCPController.boolDone = true;
TCPController.tcpServer.Close(); TCPController.tcpServer.Stop();
TCPController.tcpServer = null; TCPController.tcpServer = null;
for (int i = 0; i < arrSendBuffer.Length - 1; i++) for (int i = 0; i < arrSendBuffer.Length - 1; i++)
@@ -57,27 +57,36 @@ internal class TCPController
while (!TCPController.boolDone) while (!TCPController.boolDone)
{ {
// Start listening // Start listening
Console.WriteLine("TCP: Waiting for packet"); Console.WriteLine("TCP: Waiting for packet");
arrReceiveByteArray = udpListener.Receive(ref ipendpointGroupEP); TcpClient tcpClient = tcpServer.AcceptTcpClient(); //if a connection exists, the server will accept it
strReceivedData = Encoding.ASCII.GetString(arrReceiveByteArray, 0, arrReceiveByteArray.Length); NetworkStream ns = tcpClient.GetStream(); //networkstream is used to send/receive messages
Console.WriteLine("Sender: {0} Payload: {1}", ipendpointGroupEP.ToString(), strReceivedData);
// Add to log history and rotate while (tcpClient.Connected && !TCPController.boolDone) //while the client is connected, we look for incoming messages
dynamic dynamicRawUDPFrame = JsonConvert.DeserializeObject(strReceivedData); // Deserialize received frame
string strRawUDPFrameType = dynamicRawUDPFrame.type;
PerunHelper.LogHistoryAdd(ref arrLogHistory, "UDP packet received, type: " + strRawUDPFrameType);
// Add to mySQL send buffer (find first empty slot)
for (int i = 0; i < arrSendBuffer.Length - 1; i++)
{ {
if (arrSendBuffer[i] == null) arrReceiveByteArray = new byte[1024]; //the messages arrive as byte array
ns.Read(arrReceiveByteArray, 0, arrReceiveByteArray.Length); //the same networkstream reads the message sent by the client
strReceivedData = Encoding.ASCII.GetString(arrReceiveByteArray, 0, arrReceiveByteArray.Length);
Console.WriteLine("Sender: {0} Payload: {1}", null , strReceivedData);
dynamic dynamicRawTCPFrame = JsonConvert.DeserializeObject(strReceivedData); // Deserialize received frame
string strRawTCPFrameType = dynamicRawTCPFrame.type;
PerunHelper.LogHistoryAdd(ref arrLogHistory, "TCP packet received, type: " + strRawTCPFrameType);
// Add to mySQL send buffer (find first empty slot)
for (int i = 0; i < arrSendBuffer.Length - 1; i++)
{ {
arrSendBuffer[i] = strReceivedData; if (arrSendBuffer[i] == null)
break; {
arrSendBuffer[i] = strReceivedData;
break;
}
} }
} }
} }
udpListener.Close(); // Close port tcpServer.Stop();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -88,6 +97,6 @@ internal class TCPController
PerunHelper.LogHistoryAdd(ref arrLogHistory, "ERROR UDP - port may be in use"); PerunHelper.LogHistoryAdd(ref arrLogHistory, "ERROR UDP - port may be in use");
} }
} }
Console.WriteLine("UDP listen stop"); Console.WriteLine("TCP listen stop");
} }
} }

View File

@@ -61,10 +61,10 @@
this.tim_200ms = new System.Windows.Forms.Timer(this.components); this.tim_200ms = new System.Windows.Forms.Timer(this.components);
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.con_txt_3rd_lotatc2 = new System.Windows.Forms.MaskedTextBox(); this.label8 = new System.Windows.Forms.Label();
this.con_txt_3rd_srs2 = new System.Windows.Forms.MaskedTextBox(); this.con_txt_dcs_instance = new System.Windows.Forms.MaskedTextBox();
this.con_check_3rd_lotatc2 = new System.Windows.Forms.CheckBox(); this.label7 = new System.Windows.Forms.Label();
this.con_check_3rd_srs2 = new System.Windows.Forms.CheckBox(); this.con_txt_dcs_server_port = new System.Windows.Forms.MaskedTextBox();
this.con_GroupBox_1.SuspendLayout(); this.con_GroupBox_1.SuspendLayout();
this.con_GroupBox_2.SuspendLayout(); this.con_GroupBox_2.SuspendLayout();
this.con_GroupBox_3.SuspendLayout(); this.con_GroupBox_3.SuspendLayout();
@@ -84,7 +84,7 @@
// //
// con_Button_Listen_ON // con_Button_Listen_ON
// //
this.con_Button_Listen_ON.Location = new System.Drawing.Point(12, 517); this.con_Button_Listen_ON.Location = new System.Drawing.Point(12, 519);
this.con_Button_Listen_ON.Name = "con_Button_Listen_ON"; this.con_Button_Listen_ON.Name = "con_Button_Listen_ON";
this.con_Button_Listen_ON.Size = new System.Drawing.Size(86, 39); this.con_Button_Listen_ON.Size = new System.Drawing.Size(86, 39);
this.con_Button_Listen_ON.TabIndex = 2; this.con_Button_Listen_ON.TabIndex = 2;
@@ -95,7 +95,7 @@
// con_Button_Listen_OFF // con_Button_Listen_OFF
// //
this.con_Button_Listen_OFF.Enabled = false; this.con_Button_Listen_OFF.Enabled = false;
this.con_Button_Listen_OFF.Location = new System.Drawing.Point(104, 517); this.con_Button_Listen_OFF.Location = new System.Drawing.Point(104, 519);
this.con_Button_Listen_OFF.Name = "con_Button_Listen_OFF"; this.con_Button_Listen_OFF.Name = "con_Button_Listen_OFF";
this.con_Button_Listen_OFF.Size = new System.Drawing.Size(86, 39); this.con_Button_Listen_OFF.Size = new System.Drawing.Size(86, 39);
this.con_Button_Listen_OFF.TabIndex = 3; this.con_Button_Listen_OFF.TabIndex = 3;
@@ -111,7 +111,7 @@
this.con_GroupBox_1.Size = new System.Drawing.Size(324, 176); this.con_GroupBox_1.Size = new System.Drawing.Size(324, 176);
this.con_GroupBox_1.TabIndex = 4; this.con_GroupBox_1.TabIndex = 4;
this.con_GroupBox_1.TabStop = false; this.con_GroupBox_1.TabStop = false;
this.con_GroupBox_1.Text = "UDP log"; this.con_GroupBox_1.Text = "Data log";
// //
// tim_1000ms // tim_1000ms
// //
@@ -225,12 +225,12 @@
this.con_GroupBox_3.Controls.Add(this.con_txt_3rd_srs); this.con_GroupBox_3.Controls.Add(this.con_txt_3rd_srs);
this.con_GroupBox_3.Controls.Add(this.con_check_3rd_lotatc); this.con_GroupBox_3.Controls.Add(this.con_check_3rd_lotatc);
this.con_GroupBox_3.Controls.Add(this.con_check_3rd_srs); this.con_GroupBox_3.Controls.Add(this.con_check_3rd_srs);
this.con_GroupBox_3.Location = new System.Drawing.Point(12, 187); this.con_GroupBox_3.Location = new System.Drawing.Point(12, 261);
this.con_GroupBox_3.Name = "con_GroupBox_3"; this.con_GroupBox_3.Name = "con_GroupBox_3";
this.con_GroupBox_3.Size = new System.Drawing.Size(324, 68); this.con_GroupBox_3.Size = new System.Drawing.Size(324, 68);
this.con_GroupBox_3.TabIndex = 6; this.con_GroupBox_3.TabIndex = 6;
this.con_GroupBox_3.TabStop = false; this.con_GroupBox_3.TabStop = false;
this.con_GroupBox_3.Text = "Instance #1"; this.con_GroupBox_3.Text = "3rd party";
// //
// con_txt_3rd_lotatc // con_txt_3rd_lotatc
// //
@@ -270,7 +270,7 @@
// //
// con_Button_Quit // con_Button_Quit
// //
this.con_Button_Quit.Location = new System.Drawing.Point(251, 517); this.con_Button_Quit.Location = new System.Drawing.Point(251, 519);
this.con_Button_Quit.Name = "con_Button_Quit"; this.con_Button_Quit.Name = "con_Button_Quit";
this.con_Button_Quit.Size = new System.Drawing.Size(86, 39); this.con_Button_Quit.Size = new System.Drawing.Size(86, 39);
this.con_Button_Quit.TabIndex = 7; this.con_Button_Quit.TabIndex = 7;
@@ -332,63 +332,59 @@
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.con_txt_3rd_lotatc2); this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.con_txt_3rd_srs2); this.groupBox1.Controls.Add(this.con_txt_dcs_instance);
this.groupBox1.Controls.Add(this.con_check_3rd_lotatc2); this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.con_check_3rd_srs2); this.groupBox1.Controls.Add(this.con_txt_dcs_server_port);
this.groupBox1.Location = new System.Drawing.Point(12, 261); this.groupBox1.Location = new System.Drawing.Point(12, 187);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(324, 68); this.groupBox1.Size = new System.Drawing.Size(324, 68);
this.groupBox1.TabIndex = 7; this.groupBox1.TabIndex = 7;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Instance #2"; this.groupBox1.Text = "DCS Connection";
// //
// con_txt_3rd_lotatc2 // label8
// //
this.con_txt_3rd_lotatc2.Location = new System.Drawing.Point(123, 39); this.label8.AutoSize = true;
this.con_txt_3rd_lotatc2.Name = "con_txt_3rd_lotatc2"; this.label8.Location = new System.Drawing.Point(41, 45);
this.con_txt_3rd_lotatc2.Size = new System.Drawing.Size(190, 20); this.label8.Name = "label8";
this.con_txt_3rd_lotatc2.TabIndex = 4; this.label8.Size = new System.Drawing.Size(62, 13);
this.con_txt_3rd_lotatc2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.con_txt_3rd_lotatc2_Click); this.label8.TabIndex = 12;
this.label8.Text = "Instance ID";
// //
// con_txt_3rd_srs2 // con_txt_dcs_instance
// //
this.con_txt_3rd_srs2.Location = new System.Drawing.Point(123, 16); this.con_txt_dcs_instance.Location = new System.Drawing.Point(106, 42);
this.con_txt_3rd_srs2.Name = "con_txt_3rd_srs2"; this.con_txt_dcs_instance.Name = "con_txt_dcs_instance";
this.con_txt_3rd_srs2.Size = new System.Drawing.Size(190, 20); this.con_txt_dcs_instance.Size = new System.Drawing.Size(207, 20);
this.con_txt_3rd_srs2.TabIndex = 3; this.con_txt_dcs_instance.TabIndex = 11;
this.con_txt_3rd_srs2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.con_txt_3rd_srs2_Click);
// //
// con_check_3rd_lotatc2 // label7
// //
this.con_check_3rd_lotatc2.AutoSize = true; this.label7.AutoSize = true;
this.con_check_3rd_lotatc2.Location = new System.Drawing.Point(6, 42); this.label7.Location = new System.Drawing.Point(41, 19);
this.con_check_3rd_lotatc2.Name = "con_check_3rd_lotatc2"; this.label7.Name = "label7";
this.con_check_3rd_lotatc2.Size = new System.Drawing.Size(100, 17); this.label7.Size = new System.Drawing.Size(59, 13);
this.con_check_3rd_lotatc2.TabIndex = 1; this.label7.TabIndex = 10;
this.con_check_3rd_lotatc2.Text = "LotATC json file"; this.label7.Text = "Server port";
this.con_check_3rd_lotatc2.UseVisualStyleBackColor = true;
// //
// con_check_3rd_srs2 // con_txt_dcs_server_port
// //
this.con_check_3rd_srs2.AutoSize = true; this.con_txt_dcs_server_port.Location = new System.Drawing.Point(106, 16);
this.con_check_3rd_srs2.Location = new System.Drawing.Point(6, 19); this.con_txt_dcs_server_port.Name = "con_txt_dcs_server_port";
this.con_check_3rd_srs2.Name = "con_check_3rd_srs2"; this.con_txt_dcs_server_port.Size = new System.Drawing.Size(207, 20);
this.con_check_3rd_srs2.Size = new System.Drawing.Size(111, 17); this.con_txt_dcs_server_port.TabIndex = 3;
this.con_check_3rd_srs2.TabIndex = 0;
this.con_check_3rd_srs2.Text = "DCS SRS json file";
this.con_check_3rd_srs2.UseVisualStyleBackColor = true;
// //
// form_Main // form_Main
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(349, 558); this.ClientSize = new System.Drawing.Size(349, 570);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.con_GroupBox_3);
this.Controls.Add(this.label5); this.Controls.Add(this.label5);
this.Controls.Add(this.con_lab_github); this.Controls.Add(this.con_lab_github);
this.Controls.Add(this.con_Button_Quit); this.Controls.Add(this.con_Button_Quit);
this.Controls.Add(this.con_GroupBox_3);
this.Controls.Add(this.con_GroupBox_2); this.Controls.Add(this.con_GroupBox_2);
this.Controls.Add(this.con_GroupBox_1); this.Controls.Add(this.con_GroupBox_1);
this.Controls.Add(this.con_Button_Listen_OFF); this.Controls.Add(this.con_Button_Listen_OFF);
@@ -447,10 +443,10 @@
private System.Windows.Forms.Timer tim_200ms; private System.Windows.Forms.Timer tim_200ms;
private System.Windows.Forms.NotifyIcon notifyIcon1; private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.MaskedTextBox con_txt_3rd_lotatc2; private System.Windows.Forms.MaskedTextBox con_txt_dcs_server_port;
private System.Windows.Forms.MaskedTextBox con_txt_3rd_srs2; private System.Windows.Forms.Label label7;
private System.Windows.Forms.CheckBox con_check_3rd_lotatc2; private System.Windows.Forms.Label label8;
private System.Windows.Forms.CheckBox con_check_3rd_srs2; private System.Windows.Forms.MaskedTextBox con_txt_dcs_instance;
} }
} }

View File

@@ -41,10 +41,9 @@ namespace Perun_v1
con_txt_3rd_srs.Text = Properties.Settings.Default.OTHER_SRS_FILE; con_txt_3rd_srs.Text = Properties.Settings.Default.OTHER_SRS_FILE;
con_check_3rd_lotatc.Checked = Properties.Settings.Default.OTHER_LOTATC_USE; con_check_3rd_lotatc.Checked = Properties.Settings.Default.OTHER_LOTATC_USE;
con_check_3rd_srs.Checked = Properties.Settings.Default.OTHER_SRS_USE; con_check_3rd_srs.Checked = Properties.Settings.Default.OTHER_SRS_USE;
con_txt_3rd_lotatc2.Text = Properties.Settings.Default.OTHER_LOTATC_FILE2; con_txt_dcs_server_port.Text = Properties.Settings.Default.DCS_Server_Port.ToString();
con_txt_3rd_srs2.Text = Properties.Settings.Default.OTHER_SRS_FILE2; con_txt_dcs_instance.Text = Properties.Settings.Default.DCS_Instance.ToString();
con_check_3rd_lotatc2.Checked = Properties.Settings.Default.OTHER_LOTATC_USE2;
con_check_3rd_srs2.Checked = Properties.Settings.Default.OTHER_SRS_USE2;
} }
private void form_Main_SaveSettings() private void form_Main_SaveSettings()
@@ -61,10 +60,9 @@ namespace Perun_v1
Properties.Settings.Default.OTHER_SRS_FILE = con_txt_3rd_srs.Text; Properties.Settings.Default.OTHER_SRS_FILE = con_txt_3rd_srs.Text;
Properties.Settings.Default.OTHER_LOTATC_USE = con_check_3rd_lotatc.Checked; Properties.Settings.Default.OTHER_LOTATC_USE = con_check_3rd_lotatc.Checked;
Properties.Settings.Default.OTHER_SRS_USE = con_check_3rd_srs.Checked; Properties.Settings.Default.OTHER_SRS_USE = con_check_3rd_srs.Checked;
Properties.Settings.Default.OTHER_LOTATC_FILE2 = con_txt_3rd_lotatc2.Text;
Properties.Settings.Default.OTHER_SRS_FILE2 = con_txt_3rd_srs2.Text; Properties.Settings.Default.DCS_Server_Port = Int32.Parse(con_txt_dcs_server_port.Text);
Properties.Settings.Default.OTHER_LOTATC_USE2 = con_check_3rd_lotatc2.Checked; Properties.Settings.Default.DCS_Instance = Int32.Parse(con_txt_dcs_instance.Text);
Properties.Settings.Default.OTHER_SRS_USE2 = con_check_3rd_srs2.Checked;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
@@ -83,10 +81,8 @@ namespace Perun_v1
con_txt_3rd_srs.Enabled = false; con_txt_3rd_srs.Enabled = false;
con_check_3rd_lotatc.Enabled = false; con_check_3rd_lotatc.Enabled = false;
con_check_3rd_srs.Enabled = false; con_check_3rd_srs.Enabled = false;
con_txt_3rd_lotatc2.Enabled = false; con_txt_dcs_server_port.Enabled = false;
con_txt_3rd_srs2.Enabled = false; con_txt_dcs_instance.Enabled = false;
con_check_3rd_lotatc2.Enabled = false;
con_check_3rd_srs2.Enabled = false;
} }
private void form_Main_EnableControls() private void form_Main_EnableControls()
@@ -104,10 +100,9 @@ namespace Perun_v1
con_txt_3rd_srs.Enabled = true; con_txt_3rd_srs.Enabled = true;
con_check_3rd_lotatc.Enabled = true; con_check_3rd_lotatc.Enabled = true;
con_check_3rd_srs.Enabled = true; con_check_3rd_srs.Enabled = true;
con_txt_3rd_lotatc2.Enabled = true; con_txt_dcs_server_port.Enabled = true;
con_txt_3rd_srs2.Enabled = true; con_txt_dcs_instance.Enabled = true;
con_check_3rd_lotatc2.Enabled = true;
con_check_3rd_srs2.Enabled = true;
} }
// ################################ User input ################################ // ################################ User input ################################
@@ -188,36 +183,6 @@ namespace Perun_v1
} }
} }
private void con_txt_3rd_srs2_Click(object sender, MouseEventArgs e)
{
// Chose SRS Json file
if (openFileDialog_SRS.ShowDialog() == DialogResult.OK)
{
con_txt_3rd_srs2.Text = openFileDialog_SRS.FileName;
con_check_3rd_srs2.Checked = true;
}
else
{
con_txt_3rd_srs2.Text = "";
con_check_3rd_srs2.Checked = false;
}
}
private void con_txt_3rd_lotatc2_Click(object sender, MouseEventArgs e)
{
// Chose LotATC Json file
if (openFileDialog_LotATC.ShowDialog() == DialogResult.OK)
{
con_txt_3rd_lotatc2.Text = openFileDialog_LotATC.FileName;
con_check_3rd_lotatc2.Checked = true;
}
else
{
con_txt_3rd_lotatc2.Text = "";
con_check_3rd_lotatc2.Checked = false;
}
}
// ################################ Form state ################################ // ################################ Form state ################################
private void con_Button_Quit_Click(object sender, EventArgs e) private void con_Button_Quit_Click(object sender, EventArgs e)
{ {
@@ -323,13 +288,9 @@ namespace Perun_v1
// Main timer to send JSON files to MySQL // Main timer to send JSON files to MySQL
string strSRSJson = ""; string strSRSJson = "";
string strLotATCJson = ""; string strLotATCJson = "";
string strSRSJson2 = "";
string strLotATCJson2 = "";
bool boolSRSdefault = true; bool boolSRSdefault = true;
bool boolLotATCdefault = true; bool boolLotATCdefault = true;
bool boolSRSdefault2 = true;
bool boolLotATCdefault2 = true;
// Handle SRS - TBD clean code for multiinstance // Handle SRS - TBD clean code for multiinstance
if (con_check_3rd_srs.Checked) if (con_check_3rd_srs.Checked)
@@ -396,70 +357,6 @@ namespace Perun_v1
} }
DatabaseController.SendToMySql(strSRSJson); DatabaseController.SendToMySql(strSRSJson);
if (con_check_3rd_srs2.Checked)
{
try
{
strSRSJson2 = System.IO.File.ReadAllText(con_txt_3rd_srs2.Text);
dynamic raw_lotatc = JsonConvert.DeserializeObject(strSRSJson2);
for (int i = 0; i < raw_lotatc.Count; i++)
{
if (raw_lotatc[i].RadioInfo != null)
{
int temp = raw_lotatc[i].RadioInfo.radios.Count - 1;
for (int j = temp; j >= 0; j--)
{
raw_lotatc[i].RadioInfo.radios[j].enc.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].encKey.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].encMode.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].freqMax.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].freqMin.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].modulation.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].freqMode.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].volMode.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].expansion.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].channel.Parent.Remove();
raw_lotatc[i].RadioInfo.radios[j].simul.Parent.Remove();
if (raw_lotatc[i].RadioInfo.radios[j].name == "No Radio")
{
raw_lotatc[i].RadioInfo.radios[j].Remove();
}
}
raw_lotatc[i].ClientChannelId.Parent.Remove();
raw_lotatc[i].RadioInfo.simultaneousTransmission.Parent.Remove();
}
}
if (raw_lotatc.Count > 0)
{
strSRSJson2 = JsonConvert.SerializeObject(raw_lotatc);
strSRSJson2 = "{'type':'100','instance':'2','payload':'" + strSRSJson2 + "'}";
}
else
{
strSRSJson2 = "{'type':'100','instance':'2','payload':{'ignore':'false'}}"; // No SRS clients connected
}
boolSRSdefault2 = false;
PerunHelper.LogHistoryAdd(ref Globals.arrLogHistory, "#2 > SRS data loaded");
}
catch
{
PerunHelper.LogHistoryAdd(ref Globals.arrLogHistory, "#2 > SRS data ERROR");
}
}
if (boolSRSdefault2)
{
strSRSJson2 = "{'type':'100','instance':'2','payload':{'ignore':'true'}}";
}
DatabaseController.SendToMySql(strSRSJson2);
// Handle LotATC - TBD clean code for multiinstance // Handle LotATC - TBD clean code for multiinstance
if (con_check_3rd_lotatc.Checked) if (con_check_3rd_lotatc.Checked)
{ {
@@ -484,30 +381,6 @@ namespace Perun_v1
strLotATCJson = "{'type':'101','instance':'1','payload':{'ignore':'true'}}"; // No LotATC controller connected strLotATCJson = "{'type':'101','instance':'1','payload':{'ignore':'true'}}"; // No LotATC controller connected
} }
DatabaseController.SendToMySql(strLotATCJson); DatabaseController.SendToMySql(strLotATCJson);
if (con_check_3rd_lotatc2.Checked)
{
try
{
strLotATCJson2 = System.IO.File.ReadAllText(con_txt_3rd_lotatc2.Text);
dynamic raw_srs = JsonConvert.DeserializeObject(strLotATCJson2);
strLotATCJson2 = "{'type':'101','instance':'2','payload':'" + strLotATCJson2 + "'}";
boolLotATCdefault2 = false;
PerunHelper.LogHistoryAdd(ref Globals.arrLogHistory, "#2 > LotATC data loaded");
}
catch
{
PerunHelper.LogHistoryAdd(ref Globals.arrLogHistory, "#2 > LotATC data ERROR");
}
}
if (boolLotATCdefault2)
{
strLotATCJson2 = "{'type':'101','instance':'2','payload':{'ignore':'true'}}"; // No LotATC controller connected
}
DatabaseController.SendToMySql(strLotATCJson2);
} }
} }
} }

View File

@@ -133,49 +133,25 @@ namespace Perun_v1.Properties {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")] [global::System.Configuration.DefaultSettingValueAttribute("48620")]
public string OTHER_LOTATC_FILE2 { public int DCS_Server_Port {
get { get {
return ((string)(this["OTHER_LOTATC_FILE2"])); return ((int)(this["DCS_Server_Port"]));
} }
set { set {
this["OTHER_LOTATC_FILE2"] = value; this["DCS_Server_Port"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")] [global::System.Configuration.DefaultSettingValueAttribute("1")]
public string OTHER_SRS_FILE2 { public int DCS_Instance {
get { get {
return ((string)(this["OTHER_SRS_FILE2"])); return ((int)(this["DCS_Instance"]));
} }
set { set {
this["OTHER_SRS_FILE2"] = value; this["DCS_Instance"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool OTHER_LOTATC_USE2 {
get {
return ((bool)(this["OTHER_LOTATC_USE2"]));
}
set {
this["OTHER_LOTATC_USE2"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool OTHER_SRS_USE2 {
get {
return ((bool)(this["OTHER_SRS_USE2"]));
}
set {
this["OTHER_SRS_USE2"] = value;
} }
} }
} }

View File

@@ -29,17 +29,11 @@
<Setting Name="MYSQL_Port" Type="System.String" Scope="User"> <Setting Name="MYSQL_Port" Type="System.String" Scope="User">
<Value Profile="(Default)">3306</Value> <Value Profile="(Default)">3306</Value>
</Setting> </Setting>
<Setting Name="OTHER_LOTATC_FILE2" Type="System.String" Scope="User"> <Setting Name="DCS_Server_Port" Type="System.Int32" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)">48620</Value>
</Setting> </Setting>
<Setting Name="OTHER_SRS_FILE2" Type="System.String" Scope="User"> <Setting Name="DCS_Instance" Type="System.Int32" Scope="User">
<Value Profile="(Default)" /> <Value Profile="(Default)">1</Value>
</Setting>
<Setting Name="OTHER_LOTATC_USE2" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="OTHER_SRS_USE2" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting> </Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@@ -8,22 +8,22 @@
<userSettings> <userSettings>
<Perun_v1.Properties.Settings> <Perun_v1.Properties.Settings>
<setting name="MYSQL_Server" serializeAs="String"> <setting name="MYSQL_Server" serializeAs="String">
<value/> <value />
</setting> </setting>
<setting name="MYSQL_User" serializeAs="String"> <setting name="MYSQL_User" serializeAs="String">
<value/> <value />
</setting> </setting>
<setting name="MYSQL_Password" serializeAs="String"> <setting name="MYSQL_Password" serializeAs="String">
<value/> <value />
</setting> </setting>
<setting name="MYSQL_DB" serializeAs="String"> <setting name="MYSQL_DB" serializeAs="String">
<value/> <value />
</setting> </setting>
<setting name="OTHER_LOTATC_FILE" serializeAs="String"> <setting name="OTHER_LOTATC_FILE" serializeAs="String">
<value/> <value />
</setting> </setting>
<setting name="OTHER_SRS_FILE" serializeAs="String"> <setting name="OTHER_SRS_FILE" serializeAs="String">
<value/> <value />
</setting> </setting>
<setting name="OTHER_LOTATC_USE" serializeAs="String"> <setting name="OTHER_LOTATC_USE" serializeAs="String">
<value>False</value> <value>False</value>
@@ -34,17 +34,11 @@
<setting name="MYSQL_Port" serializeAs="String"> <setting name="MYSQL_Port" serializeAs="String">
<value>3306</value> <value>3306</value>
</setting> </setting>
<setting name="OTHER_LOTATC_FILE2" serializeAs="String"> <setting name="DCS_Server_Port" serializeAs="String">
<value/> <value>48620</value>
</setting> </setting>
<setting name="OTHER_SRS_FILE2" serializeAs="String"> <setting name="DCS_Instance" serializeAs="String">
<value/> <value>1</value>
</setting>
<setting name="OTHER_LOTATC_USE2" serializeAs="String">
<value>False</value>
</setting>
<setting name="OTHER_SRS_USE2" serializeAs="String">
<value>False</value>
</setting> </setting>
</Perun_v1.Properties.Settings> </Perun_v1.Properties.Settings>
</userSettings> </userSettings>