コード例 #1
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            try
            {
                cloud.bzu.Currency res;

                if (!Enum.TryParse <cloud.bzu.Currency>(txtFrom.Text, out res))
                {
                    throw new ArgumentException("Please Fill a Valid Currency Simbole");
                }
                if (!Enum.TryParse <cloud.bzu.Currency>(txtTo.Text, out res))
                {
                    throw new ArgumentException("Please Fill a Valid Currency Simbole");
                }


                var service    = new cloud.bzu.ExService();
                var currencies = new cloud.bzu.currencies
                {
                    FromCurrency = (cloud.bzu.Currency)Enum.Parse(typeof(cloud.bzu.Currency), txtFrom.Text),
                    ToCurrency   = (cloud.bzu.Currency)Enum.Parse(typeof(cloud.bzu.Currency), txtTo.Text)
                };
                var result = service.CalculateExRate(currencies);
                lblRate.Text = txtFrom.Text + "->" + txtTo.Text + "=" + result.ToString(CultureInfo.InvariantCulture);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
ファイル: Reference.cs プロジェクト: BZUmaster/ExchangeRate
        public float CalculateExRate([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://bzu.cloud:8080/ExProj/services/")] currencies parameters)
        {
            object[] results = this.Invoke("CalculateExRate", new object[] {
                parameters
            });

            return((float)(results[0]));
        }
コード例 #3
0
ファイル: Reference.cs プロジェクト: BZUmaster/ExchangeRate
 /// <remarks/>
 public void CalculateExRateAsync(currencies parameters, object userState)
 {
     if ((this.CalculateExRateOperationCompleted == null))
     {
         this.CalculateExRateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCalculateExRateOperationCompleted);
     }
     this.InvokeAsync("CalculateExRate", new object[] {
         parameters
     }, this.CalculateExRateOperationCompleted, userState);
 }
コード例 #4
0
ファイル: Reference.cs プロジェクト: BZUmaster/ExchangeRate
 /// <remarks/>
 public void CalculateExRateAsync(currencies parameters)
 {
     this.CalculateExRateAsync(parameters, null);
 }