private void btnDistribute_Click(object sender, EventArgs e) { if (Server_Connection_Settings.Is_Server_Connected() == true) { Shared_Data.Data_To_Distribute(Get_Current_Data_Set()); Shared_Data.New_Distribution_Requested = true; } else { MessageBox.Show("Server not running !"); } }
private void timer1_Tick(object sender, EventArgs e) { if (Shared_Data.Update_Main_Data_Display == true) { timer1.Enabled = false; System.Windows.Forms.DialogResult T = MessageBox.Show("New data set available, Proceed with the update?", "Confirm", MessageBoxButtons.YesNo); if (T == System.Windows.Forms.DialogResult.Yes) { foreach (string S in Shared_Data.Received_Data_List_From_Server) { string[] words = S.Split(' '); // Check if the string has more than two strings words = Check_For_Multiple_Strings(words); switch (words[0]) { ///////////////////////////////////////////////////////////////////////////////// // CCL case "ZG_US:": this.checkBox_US_ZG.CheckState = Check_State_From_String(words[1]); break; case "ZG_US_VALUE:": this.textBox_CCL_US_Value.Text = words[1]; break; case "ZG_UW:": this.checkBox_UW_ZG.CheckState = Check_State_From_String(words[1]); break; case "ZG_UW_VALUE:": this.textBox_CCL_UW_Value.Text = words[1]; break; case "ZG_UN:": this.checkBox_UN_ZG.CheckState = Check_State_From_String(words[1]); break; case "ZG_UN_VALUE:": this.textBox_CCL_UN_Value.Text = words[1]; break; case "ZG_LS:": this.checkBox_LS_ZG.CheckState = Check_State_From_String(words[1]); break; case "ZG_LS_VALUE:": this.textBox_CCL_LS_Value.Text = words[1]; break; case "ZG_LW:": this.checkBox_LW_ZG.CheckState = Check_State_From_String(words[1]); break; case "ZG_LW_VALUE:": this.textBox_CCL_LW_Value.Text = words[1]; break; case "ZG_LN:": this.checkBox_LN_ZG.CheckState = Check_State_From_String(words[1]); break; case "ZG_LN_VALUE:": this.textBox_CCL_LN_Value.Text = words[1]; break; case "LDZA:": textBoxLDZA.Text = words[1]; break; case "LDDU:": textBoxLDDU.Text = words[1]; break; case "LDSP:": textBoxLDSP.Text = words[1]; break; case "LDOS:": textBoxLDOS.Text = words[1]; break; case "ZGFIC:": textBoxZGFIC.Text = words[1]; break; ///////////////////////////////////////////////////////////////////////////////// // SMATSA case "BG_UW:": this.checkBox_SMATSA_UW.CheckState = Check_State_From_String(words[1]); break; case "BG_UW_VALUE:": this.textBox_SMATSA_UW.Text = words[1]; break; case "BG_UN:": this.checkBox_SMATSA_UN.CheckState = Check_State_From_String(words[1]); break; case "BG_UN_VALUE:": this.textBox_SMATSA_UN.Text = words[1]; break; case "BG_LOWER:": this.checkBox_SMATSA_LOWER.CheckState = Check_State_From_String(words[1]); break; case "BG_LOWER_VALUE:": this.textBox_SMATSA_LOWER.Text = words[1]; break; case "LYBE:": this.textBoxLYBE.Text = words[1]; break; case "LYPG:": this.textBoxLYPG.Text = words[1]; break; case "SEC_LYPG:": this.textBoxSectorLYPG.Text = words[1]; break; ///////////////////////////////////////////////////////////////////////////////// // GENERAL case "DFL:": this.textBox_Division_Level.Text = words[1]; break; ///////////////////////////////////////////////////////////////////////////////// // BHANSA case "LQSA:": this.textBoxLQSA.Text = words[1]; break; case "LQMO:": this.textBoxLQMO.Text = words[1]; break; case "LQTZ:": this.textBoxLQTZ.Text = words[1]; break; case "LQBK:": this.textBoxLQBK.Text = words[1]; break; case "FIC:": this.textBoxFIC.Text = words[1]; break; case "CHF_SUP:": this.textBoxChief_Sup.Text = words[1]; break; case "FREE_1:": this.textBoxFree_One.Text = words[1]; break; case "FREE_2:": this.textBoxFree_Two.Text = words[1]; break; case "FREE_3:": this.textBoxFree_Three.Text = words[1]; break; } } } Shared_Data.Update_Main_Data_Display = false; Shared_Data.Notify_Main_Display_Updated = true; timer1.Enabled = true; } if (Shared_Data.I_Am_Server == true) { this.toolsToolStripMenuItem.DropDownItems[1].Enabled = true; this.toolsToolStripMenuItem.DropDownItems[2].Enabled = false; this.Text = "BHANSA Frequency Managament " + Shared_Data.Position_Name + " (Server)"; distributeDataToolStripMenuItem.Enabled = true; } else { this.toolsToolStripMenuItem.DropDownItems[1].Enabled = false; this.toolsToolStripMenuItem.DropDownItems[2].Enabled = true; this.Text = "BHANSA Frequency Managament " + Shared_Data.Position_Name + " (Client)"; distributeDataToolStripMenuItem.Enabled = false; } if (Shared_Data.Server_Client_Mode_Changed == true) { Server_Connection_Settings_Form.Close(); Clinet_Connection_Settings_Form.Close(); Server_Connection_Settings_Form = new Server_Connection_Settings(); Clinet_Connection_Settings_Form = new Client_Connection_Settings(); Server_Connection_Settings_Form.Visible = false; Clinet_Connection_Settings_Form.Visible = false; if (Shared_Data.I_Am_Server == true) { Server_Connection_Settings_Form.Visible = true; } else { Clinet_Connection_Settings_Form.Visible = true; } Shared_Data.Server_Client_Mode_Changed = false; } if (Shared_Data.Initiate_Data_Distribution == true) { Shared_Data.Data_To_Distribute(Get_Current_Data_Set()); Shared_Data.New_Distribution_Requested = true; Shared_Data.Initiate_Data_Distribution = false; } }