private void logonButton_Click(object sender, EventArgs e) { //send authorization data to mainform and Validator validator = new Validator(); validator.ValidationState += new Action<string>(client_DoReport); // Authentification auth = new Authentification(); string log = validator.ValidateText(this.loginTextBox.Text); string passwd = validator.ValidateText(this.passwordMaskedTextBox.Text); if (validator.DataIsValid) { Messenger.Default.Send<Authentification>(new Authentification() { Login = log, Password = passwd }); this.Close(); } }
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(); } } }