private void btnApply_Click(object sender, EventArgs e) { try { if (txtIP.Text.Trim() == "") { MessageBox.Show("Please specify the IP Address of the Chat Server."); } else { System.Reflection.Assembly Asm = System.Reflection.Assembly.GetExecutingAssembly(); string path = Asm.Location + ".config"; string strKeyNm = "ChatService"; SaveConfigData(path, strKeyNm, txtIP.Text); btnApply.Enabled = false; IPAddressInfoEventArgs ipInfo = new IPAddressInfoEventArgs(txtIP.Text.Trim()); OnIPChange(this, ipInfo); } } catch (Exception ex) { MessageBox.Show("Failed to save the data in the config file."); } }
private void Form1_IPChange(object sender, IPAddressInfoEventArgs e) { chat.RemoveUser(lblUserName.Text); strServiceIP = e.IPAddress; chat.Url = "http://" + strServiceIP + "/ChatService.asmx"; // Calling the web service for 'AddUser' for adding himself after logging. chat.AddUser(lblUserName.Text); timer1.Enabled = true; }
private void OnIPChange(object sender, IPAddressInfoEventArgs e) { // Check if there are any Subscribers if (IPChange != null) { // Call the Event IPChange(sender, e); } }
private void Form1_IPChange(object sender, IPAddressInfoEventArgs e) { chat.RemoveUser(lblUserName.Text); strServiceIP = e.IPAddress; chat.Url = "http://" + strServiceIP + "/ChatService.asmx"; // Calling the web service for 'AddUser' for adding himself after logging. chat.AddUser(lblUserName.Text); timer1.Enabled = true; }
private void btnApply_Click(object sender, EventArgs e) { try { if (txtIP.Text.Trim() == "") { MessageBox.Show("Please specify the IP Address of the Chat Server."); } else { System.Reflection.Assembly Asm = System.Reflection.Assembly.GetExecutingAssembly(); string path = Asm.Location + ".config"; string strKeyNm = "ChatService"; SaveConfigData(path, strKeyNm, txtIP.Text); btnApply.Enabled = false; IPAddressInfoEventArgs ipInfo = new IPAddressInfoEventArgs(txtIP.Text.Trim()); OnIPChange(this, ipInfo); } } catch(Exception ex) { MessageBox.Show("Failed to save the data in the config file."); } }
private void OnIPChange(object sender, IPAddressInfoEventArgs e) { // Check if there are any Subscribers if (IPChange != null) { // Call the Event IPChange(sender, e); } }