Beispiel #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;
            }
        }
Beispiel #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;
            }
        }
Beispiel #3
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;
            }
        }
Beispiel #4
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;
            }
        }
Beispiel #5
0
        public static void CallCounter()
        {
            // 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
                //    {
                //        // dsc
                //    }
                //    catch (Exception ex)
                //    {
                //        MessageBox.Show(ex.Message);
                //    }
                //    finally
                //    {
                //        if (!m_ReuseProxy)
                //        {
                //            dsc.Close();
                //            dsc = null;
                //        }
                //    }
                //}

                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.GetCounter().ToString();
                    }
                    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.GetCounter().ToString();
                    }
                    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();
            }
        }