コード例 #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
ファイル: LemonWayClient.cs プロジェクト: AchrafHAK/LemonWay
        /// <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);
        }