private void UpdateAllPanelStatus() { // SecretariatClient client = new SecretariatClient(WCFClientHelper.HttpBinder, WCFClientHelper.GetEndpointAddress(Settings.WCFServiceAddress, "WCFService.svc")) using (SecretariatServiceClient client1 = new SecretariatServiceClient(WCFClientHelper.HttpBinder, WCFClientHelper.GetEndpointAddress(Settings.ServerIP1, SERVICE_NAME))) { UpdateIPLabel(1, WCFClientHelper.GetEndpointAddress(Settings.ServerIP1, SERVICE_NAME).ToString()); UpdatePanelStatus(1, client1); } using (SecretariatServiceClient client2 = new SecretariatServiceClient(WCFClientHelper.HttpBinder, WCFClientHelper.GetEndpointAddress(Settings.ServerIP2, SERVICE_NAME))) { UpdateIPLabel(2, WCFClientHelper.GetEndpointAddress(Settings.ServerIP2, SERVICE_NAME).ToString()); UpdatePanelStatus(2, client2); } }
private void _btnStartTestURL2_Click(object sender, EventArgs e) { UpdateStatusLabel(2, "Started.. Awaiting update"); Task.Factory.StartNew(() => //var thread = new Thread(() => { using (SecretariatServiceClient client2 = new SecretariatServiceClient(WCFClientHelper.HttpBinder, WCFClientHelper.GetEndpointAddress(Settings.ServerIP2, SERVICE_NAME))) { if (String.IsNullOrEmpty(_txtTestURL2.Text)) { MessageBox.Show("Enter a URL to test."); return; } client2.TestURL(_txtTestURL2.Text); } }); // thread.Start(); // thread.Join(); }
//Move these to a control #region Panel 1 private void _btnStartBatch1_Click(object sender, EventArgs e) { _ddlTestURLBatch1.Enabled = false; UpdateStatusLabel(1, "Started.. Awaiting update"); var thread = new Thread(() => { using (SecretariatServiceClient client1 = new SecretariatServiceClient(WCFClientHelper.HttpBinder, WCFClientHelper.GetEndpointAddress(Settings.ServerIP1, SERVICE_NAME))) { if (String.IsNullOrEmpty(_txtTestURL1.Text)) { MessageBox.Show("Enter a URL to test."); return; } foreach (var item in URLBatchUtility.LoadURLsFromBatch(_ddlTestURLBatch1.SelectedItem.ToString())) { client1.TestURL(item); } } }); thread.Start(); //thread.Join(); _ddlTestURLBatch1.Enabled = true;; }