Exemple #1
0
        //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;;
        }
Exemple #2
0
 private void UpdatePanelStatus(int panelId, SecretariatServiceClient client)
 {
     if (CheckIfAwake(client, FindOval(panelId)))
     {
         UpdateURLLabel(panelId, client.CheckLastURL());
         UpdateStartedLabel(panelId, client.CheckStartTime());
         UpdateStatusLabel(panelId, client.CheckStatus());
     }
 }
Exemple #3
0
        private bool CheckIfAwake(SecretariatServiceClient client, Microsoft.VisualBasic.PowerPacks.OvalShape oval)
        {
            oval.FillStyle = Microsoft.VisualBasic.PowerPacks.FillStyle.Solid;

            if (client.CheckConnection() == "Ack")
            {
                oval.FillColor = Color.Green;
                return(true);
            }
            else
            {
                oval.FillColor = Color.Red;
                return(false);
            }
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
        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();
        }