static void GetStateNameCallback(IAsyncResult result)
        {
            XmlRpcAsyncResult clientResult = (XmlRpcAsyncResult)result;
            IStateName        betty        = (IStateName)clientResult.ClientProtocol;
            BettyAsyncState   asyncState   = (BettyAsyncState)result.AsyncState;

            try
            {
                string s = betty.EndGetStateName(result);
                asyncState.theForm.Invoke(new AppendSuccessDelegate(
                                              asyncState.theForm.AppendSuccess), asyncState.stateNumber, s);
            }
            catch (Exception ex)
            {
                asyncState.theForm.Invoke(new AppendExceptionDelegate(
                                              asyncState.theForm.AppendException), ex);
            }
        }
        private void butGetName_Click(object sender, System.EventArgs e)
        {
            IStateName betty = XmlRpcProxyGen.Create <IStateName>();

            betty.Timeout = 10000;
            try
            {
                AsyncCallback   acb        = new AsyncCallback(GetStateNameCallback);
                int             num        = Convert.ToInt32(txtStateNumber.Text);
                BettyAsyncState asyncState = new BettyAsyncState(num, this);
                IAsyncResult    asr        = betty.BeginGetStateName(num, acb, asyncState);
                if (asr.CompletedSynchronously)
                {
                    string ret = betty.EndGetStateName(asr);
                    AppendSuccess(num, ret);
                }
            }
            catch (Exception ex)
            {
                AppendException(ex);
            }
        }
 private void butGetName_Click(object sender, System.EventArgs e)
 {
   IStateName betty = XmlRpcProxyGen.Create<IStateName>();
   betty.Timeout = 10000;
   try
   {
     AsyncCallback acb = new AsyncCallback(GetStateNameCallback);
     int num = Convert.ToInt32(txtStateNumber.Text);
     BettyAsyncState asyncState = new BettyAsyncState(num, this);
     IAsyncResult asr = betty.BeginGetStateName(num, acb, asyncState);
     if (asr.CompletedSynchronously)
     {
       string ret = betty.EndGetStateName(asr);
       AppendSuccess(num, ret);
     }
   }
   catch (Exception ex)
   {
     AppendException(ex);
   }
 }