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 btnGetCounter_Click(object sender, EventArgs e)
        {
            DemoServiceSesAClient.DemoSvcSesAClient   dssc;
            DemoServiceSesNAClient.DemoSvcSesNAClient dssnac;

            switch (cBoxClientList.SelectedItem.ToString())
            {
            case "DemoServiceClient":
                MessageBox.Show("Not implemented in DemoServiceClient!");
                break;

            case "DemoServiceSesAClient":
                dssc = new DemoServiceSesAClient.DemoSvcSesAClient();
                tbGetCounter.Text = dssc.GetCounter().ToString();
                dssc.Close();
                break;

            case "DemoServiceSesNAClient":
                dssnac            = new DemoServiceSesNAClient.DemoSvcSesNAClient();
                tbGetCounter.Text = dssnac.GetCounter().ToString();
                dssnac.Close();
                break;

            default:
                MessageBox.Show("No Client!");
                break;
            }
        }
Example #3
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 #4
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 #5
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();
            }
        }