Example #1
0
        private void btnEcho_Click(object sender, EventArgs e)
        {
            DemoServiceClient.DemoServiceClient       dsc;
            DemoServiceSesAClient.DemoSvcSesAClient   dssc;
            DemoServiceSesNAClient.DemoSvcSesNAClient dssnac;

            switch (cBoxClientList.SelectedItem.ToString())
            {
            case "DemoServiceClient":
                dsc          = new DemoServiceClient.DemoServiceClient();
                tbEcho.Text += dsc.Echo(tbEcho.Text);
                dsc.Close();
                break;

            case "DemoServiceSesAClient":
                dssc         = new DemoServiceSesAClient.DemoSvcSesAClient();
                tbEcho.Text += dssc.Echo(tbEcho.Text);
                dssc.Close();
                break;

            case "DemoServiceSesNAClient":
                dssnac       = new DemoServiceSesNAClient.DemoSvcSesNAClient();
                tbEcho.Text += dssnac.Echo(tbEcho.Text);
                dssnac.Close();
                break;

            default:
                MessageBox.Show("No Client!");
                break;
            }
        }
Example #2
0
        private void btnGuessGender_Click(object sender, EventArgs e)
        {
            DemoServiceClient.DemoServiceClient dsc;
            DemoServiceClient.PersonInfo        pi = new DemoServiceClient.PersonInfo();
            DemoServiceClient.Sex gndr;

            pi.Age     = 40;
            pi.Name    = "ABC";     //  Should return Female
            pi.Surname = "XYZ";

            switch (cBoxClientList.SelectedItem.ToString())
            {
            case "DemoServiceClient":
                dsc = new DemoServiceClient.DemoServiceClient();
                //tbHostTime.Text = dsc.GetHostTime().ToLongTimeString();
                gndr = dsc.GuessGender(pi);
                if (gndr == DemoServiceClient.Sex.Female)
                {
                    tbGuessGender.Text = "Female";
                }
                else
                {
                    tbGuessGender.Text = "Male";
                }

                dsc.Close();
                break;

            default:
                MessageBox.Show("No Client!");
                break;
            }
        }
Example #3
0
        private void btnCauseException_Click(object sender, EventArgs e)
        {
            DemoServiceClient.DemoServiceClient dsc;

            switch (cBoxClientList.SelectedItem.ToString())
            {
            case "DemoServiceClient":
                dsc = new DemoServiceClient.DemoServiceClient();
                dsc.CauseException();
                dsc.Close();
                break;

            case "DemoServiceSesAClient":
                MessageBox.Show("Not implemented in DemoServiceSesAClient!");
                break;

            case "DemoServiceSesNAClient":
                MessageBox.Show("Not implemented in DemoServiceSesNAClient!");
                break;

            default:
                MessageBox.Show("No Client!");
                break;
            }
        }
Example #4
0
        private void btnGetHostTime_Click(object sender, EventArgs e)
        {
            DemoServiceClient.DemoServiceClient       dsc;
            DemoServiceSesAClient.DemoSvcSesAClient   dssc;
            DemoServiceSesNAClient.DemoSvcSesNAClient dssnac;

            switch (cBoxClientList.SelectedItem.ToString())
            {
            case "DemoServiceClient":
                dsc             = new DemoServiceClient.DemoServiceClient();
                tbHostTime.Text = dsc.GetHostTime().ToLongTimeString();
                dsc.Close();
                break;

            case "DemoServiceSesAClient":
                dssc            = new DemoServiceSesAClient.DemoSvcSesAClient();
                tbHostTime.Text = dssc.GetHostTime().ToLongTimeString();
                dssc.Close();
                break;

            case "DemoServiceSesNAClient":
                dssnac          = new DemoServiceSesNAClient.DemoSvcSesNAClient();
                tbHostTime.Text = dssnac.GetHostTime().ToLongTimeString();
                dssnac.Close();
                break;

            default:
                MessageBox.Show("No Client!");
                break;
            }
        }
Example #5
0
        public static void CallPing()
        {
            // DemoServiceClient.DemoServiceClient demo = new DemoServiceClient.DemoServiceClient(m_SelectedEP);

            DemoServiceClient.DemoServiceClient       dsc    = null;
            DemoServiceSesAClient.DemoSvcSesAClient   dssc   = null;
            DemoServiceSesNAClient.DemoSvcSesNAClient dssnac = null;
            string strMessage = "";


            if (m_SelectedClient.Equals("DemoServiceClient"))
            {
                while (true)
                {
                    dsc = new DemoServiceClient.DemoServiceClient(m_SelectedEP);

                    try
                    {
                        strMessage = dsc.Ping();
                    }
                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                    }
                }
            }

            if (m_SelectedClient.Equals("DemoServiceSesAClient"))
            {
                while (true)
                {
                    dssc = new DemoServiceSesAClient.DemoSvcSesAClient(m_SelectedEP);

                    try
                    {
                        strMessage = dssc.Ping();
                    }
                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                    }
                }
            }

            if (m_SelectedClient.Equals("DemoServiceSesNAClient"))
            {
                while (true)
                {
                    dssnac = new DemoServiceSesNAClient.DemoSvcSesNAClient(m_SelectedEP);

                    try
                    {
                        strMessage = dssnac.Ping();
                    }
                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                    }
                }
            }

            //if (dsc != null)
            //    dsc.Close();

            //if (dssc != null)
            //    dssc.Close();

            //if (dssnac != null)
            //    dssnac.Close();
        }
Example #6
0
        public static void CallHostTime()
        {
            // DemoServiceClient.DemoServiceClient demo = new DemoServiceClient.DemoServiceClient(m_SelectedEP);

            DemoServiceClient.DemoServiceClient       dsc    = null;
            DemoServiceSesAClient.DemoSvcSesAClient   dssc   = null;
            DemoServiceSesNAClient.DemoSvcSesNAClient dssnac = null;
            string strMessage = "";

            switch (m_SelectedClient)
            {
            case "DemoServiceClient":
                dsc = new DemoServiceClient.DemoServiceClient(m_SelectedEP);
                // tbHostTime.Text = UPDATE THE RICHTEXTBOX
                //dsc.GetHostTime().ToLongTimeString();

                while (!m_Stop.WaitOne(100))
                {
                    if (dsc == null)
                    {
                        dsc = new DemoServiceClient.DemoServiceClient(m_SelectedEP);
                    }

                    try
                    {
                        strMessage = dsc.GetHostTime().ToLongTimeString();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        if (!m_ReuseProxy)
                        {
                            dsc.Close();
                            dsc = null;
                        }
                    }

                    strMessage = GetThreadID() + " " + strMessage;
                    WriteOutput(strMessage);
                }

                break;

            case "DemoServiceSesAClient":
                dssc = new DemoServiceSesAClient.DemoSvcSesAClient(m_SelectedEP);

                while (!m_Stop.WaitOne(100))
                {
                    if (dssc == null)
                    {
                        dssc = new DemoServiceSesAClient.DemoSvcSesAClient(m_SelectedEP);
                    }

                    try
                    {
                        strMessage = dssc.GetHostTime().ToLongTimeString();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        if (!m_ReuseProxy)
                        {
                            dssc.Close();
                            dssc = null;
                        }
                    }
                    strMessage = GetThreadID() + " " + strMessage;
                    WriteOutput(strMessage);
                }

                break;

            case "DemoServiceSesNAClient":
                dssnac = new DemoServiceSesNAClient.DemoSvcSesNAClient(m_SelectedEP);

                while (!m_Stop.WaitOne(100))
                {
                    if (dssnac == null)
                    {
                        dssnac = new DemoServiceSesNAClient.DemoSvcSesNAClient(m_SelectedEP);
                    }

                    try
                    {
                        strMessage = dssnac.GetHostTime().ToLongTimeString();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        if (!m_ReuseProxy)
                        {
                            dssnac.Close();
                            dssnac = null;
                        }
                    }
                    strMessage = GetThreadID() + " " + strMessage;
                    WriteOutput(strMessage);
                }
                break;

            default:
                MessageBox.Show("No Client!");
                break;
            }


            if (dsc != null)
            {
                dsc.Close();
            }

            if (dssc != null)
            {
                dssc.Close();
            }

            if (dssnac != null)
            {
                dssnac.Close();
            }
        }
Example #7
0
        public static void CallDelay()
        {
            // DemoServiceClient.DemoServiceClient demo = new DemoServiceClient.DemoServiceClient(m_SelectedEP);

            DemoServiceClient.DemoServiceClient       dsc = null;
            DemoServiceSesAClient.DemoSvcSesAClient   dssc = null;
            DemoServiceSesNAClient.DemoSvcSesNAClient dssnac = null;
            System.DateTime start, stop;
            string          strMessage = "";


            switch (m_SelectedClient)
            {
            case "DemoServiceClient":
                dsc = new DemoServiceClient.DemoServiceClient(m_SelectedEP);

                while (!m_Stop.WaitOne(100))
                {
                    if (dsc == null)
                    {
                        dsc = new DemoServiceClient.DemoServiceClient(m_SelectedEP);
                    }

                    try
                    {
                        start = DateTime.Now;
                        dsc.Delay(m_Duration);
                        stop       = DateTime.Now;
                        strMessage = start.ToLongTimeString() + " - " + stop.ToLongTimeString();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        if (!m_ReuseProxy)
                        {
                            dsc.Close();
                            dsc = null;
                        }
                    }
                    strMessage = GetThreadID() + " " + strMessage;
                    WriteOutput(strMessage);
                }

                break;

            case "DemoServiceSesAClient":
                dssc = new DemoServiceSesAClient.DemoSvcSesAClient(m_SelectedEP);

                while (!m_Stop.WaitOne(100))
                {
                    if (dssc == null)
                    {
                        dssc = new DemoServiceSesAClient.DemoSvcSesAClient(m_SelectedEP);
                    }

                    try
                    {
                        start = DateTime.Now;
                        dssc.Delay(m_Duration);
                        stop       = DateTime.Now;
                        strMessage = start.ToLongTimeString() + " - " + stop.ToLongTimeString();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        if (!m_ReuseProxy)
                        {
                            dssc.Close();
                            dssc = null;
                        }
                    }
                    strMessage = GetThreadID() + " " + strMessage;
                    WriteOutput(strMessage);
                }

                break;

            case "DemoServiceSesNAClient":
                dssnac = new DemoServiceSesNAClient.DemoSvcSesNAClient(m_SelectedEP);

                while (!m_Stop.WaitOne(100))
                {
                    if (dssnac == null)
                    {
                        dssnac = new DemoServiceSesNAClient.DemoSvcSesNAClient(m_SelectedEP);
                    }

                    try
                    {
                        start = DateTime.Now;
                        dssnac.Delay(m_Duration);
                        stop       = DateTime.Now;
                        strMessage = start.ToLongTimeString() + " - " + stop.ToLongTimeString();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        if (!m_ReuseProxy)
                        {
                            dssnac.Close();
                            dssnac = null;
                        }
                    }

                    strMessage = GetThreadID() + " " + strMessage;
                    WriteOutput(strMessage);
                }
                break;

            default:
                MessageBox.Show("No Client!");
                break;
            }


            if (dsc != null)
            {
                dsc.Close();
            }

            if (dssc != null)
            {
                dssc.Close();
            }

            if (dssnac != null)
            {
                dssnac.Close();
            }
        }