Example #1
0
        private void calculateButton_Click(object sender, EventArgs e)
        {
            Validator validator = new Validator();

            validator.ValidationState += new Action <string>(client_DoReport);

            if (this.currencyListComboBox.SelectedItem != null)
            {
                string currency = validator.ValidateText(this.currencyListComboBox.SelectedItem.ToString());
                double amount   = validator.ValidateAndConvertToDouble(this.amountTextBox.Text);

                const string UAH  = "UAH";
                DateTime     date = DateTime.Now;

                if (validator.DataIsValid)
                {
                    DataModelForConverter data = new DataModelForConverter();
                    data.Amount = amount;
                    data.Date   = date;
                    data.DestinationCurrency = UAH;
                    data.SourceCurrency      = currency;

                    ProxyWorker <MoneyConverterClient> client = null;
                    client           = new ProxyWorker <MoneyConverterClient>(data);
                    client.DoReport += new Action <string>(client_DoReport);
                    client.DoAction += new Action <MoneyConverterClient, object>(client_ConvertCurrency);
                    client.Login     = auth.Login;
                    client.Password  = auth.Password;

                    client.Start();
                }
            }
        }
Example #2
0
        private void GetCurrencyList()
        {
            ProxyWorker <MoneyConverterClient> client = null;

            client           = new ProxyWorker <MoneyConverterClient>(null);
            client.DoReport += new Action <string>(client_DoReport);
            client.DoAction += new Action <MoneyConverterClient, object>(client_DoList);
            client.Login     = auth.Login;
            client.Password  = auth.Password;

            client.Start();
        }
Example #3
0
        private void calculateButton_Click(object sender, EventArgs e)
        {
            Validator validator = new Validator();
            validator.ValidationState += new Action<string>(client_DoReport);

            if(this.currencyListComboBox.SelectedItem!=null)
            {
                string currency = validator.ValidateText(this.currencyListComboBox.SelectedItem.ToString());
                double amount = validator.ValidateAndConvertToDouble(this.amountTextBox.Text);

                const string UAH = "UAH";
                DateTime date = DateTime.Now;

                if (validator.DataIsValid)
                {
                    DataModelForConverter data = new DataModelForConverter();
                    data.Amount = amount;
                    data.Date = date;
                    data.DestinationCurrency = UAH;
                    data.SourceCurrency = currency;

                    ProxyWorker<MoneyConverterClient> client = null;
                    client = new ProxyWorker<MoneyConverterClient>(data);
                    client.DoReport += new Action<string>(client_DoReport);
                    client.DoAction += new Action<MoneyConverterClient, object>(client_ConvertCurrency);
                    client.Login = auth.Login;
                    client.Password = auth.Password;

                    client.Start();
                }
            }
            
        }
Example #4
0
        private void GetCurrencyList()
        {
            ProxyWorker<MoneyConverterClient> client = null;
            client = new ProxyWorker<MoneyConverterClient>(null);
            client.DoReport += new Action<string>(client_DoReport);
            client.DoAction += new Action<MoneyConverterClient,object>(client_DoList);
            client.Login = auth.Login;
            client.Password = auth.Password;

            client.Start();
        }