예제 #1
0
 private void FibonacciButton_Click(object sender, EventArgs e)
 {
     if (fibonacciValid)
     {
         Form waitForm = new WaitForm(this);
         waitForm.Show(this);
         string      body           = @"<Fibonacci xmlns=""http://chanhduong.org/""><n>" + n + "</n></Fibonacci>";
         SoapService soapService    = new SoapService(ChanhDuongURL);
         string      textMessage    = "";
         string      captionMessage = "";
         try
         {
             soapService.SendRequest(body).Wait();
             FibonacciResponse result = (FibonacciResponse)SerializerSoapXml.Deserialize(typeof(FibonacciResponse), soapService.response);
             textMessage    = result.FibonacciResult;
             captionMessage = "Fibonacci of " + n;
         }
         catch (Exception ex)
         {
             textMessage    = ex.Message;
             captionMessage = "Error";
         }
         finally
         {
             waitForm.Close();
             MessageBox.Show(textMessage, captionMessage, MessageBoxButtons.OK);
         }
     }
     else
     {
         MessageBox.Show("N is blank!", "Info", MessageBoxButtons.OK);
     }
 }
예제 #2
0
        /// <summary>
        /// This method calls the client Fibonacci asynchronously
        /// </summary>
        /// <param name="val"></param>
        /// <returns></returns>
        public async static Task <string> FibonacciConsoleClientAsync(int val)
        {
            FibonacciResponse returnedValue = await service.FibonacciAsync(val, timeout : 2000);

            return(returnedValue.Body.FibonacciResult);
        }