AMPSExcel.ServerForm.btnTestConnection_Click C# (CSharp) Метод

btnTestConnection_Click() приватный Метод

private btnTestConnection_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void btnTestConnection_Click(object sender, EventArgs e)
        {
            // Try to create a new client and logon.
            this.Cursor = Cursors.WaitCursor;
            Globals.AMPSAddin.Application.StatusBar = "Testing connnectivity...";
            try
            {
                Client aClient = new Client(Guid.NewGuid().ToString());
                aClient.connect(getURL());
                aClient.logon();
                this.Cursor = Cursors.Default;
                MessageBox.Show(this, "Test connection succeeded.", "AMPS Connection", MessageBoxButtons.OK, MessageBoxIcon.Information);
                aClient.close();
            }
            catch (AMPSException ae)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(this, string.Format("Error connecting to server: {0}{1}",
                     ae.Message, ae.InnerException != null ? (" (" + ae.InnerException.Message + ")") : ""),
                     "AMPS Connection", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Globals.AMPSAddin.Application.StatusBar = false;
        }