protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetActionBar(toolbar); ActionBar.Title = "MobiCurrency"; leftSpinner = FindViewById <Spinner>(Resource.Id.spinnerLeft); rightSpinner = FindViewById <Spinner>(Resource.Id.spinnerRight); leftSpinner.ItemSelected += SpinnerItemSelected; rightSpinner.ItemSelected += SpinnerItemSelected; var spinnerAdapter = ArrayAdapter.CreateFromResource (this, Resource.Array.currencies, Android.Resource.Layout.SimpleSpinnerItem); spinnerAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); leftSpinner.Adapter = spinnerAdapter; rightSpinner.Adapter = spinnerAdapter; fromCurrency = FindViewById <EditText>(Resource.Id.editTextCurrencyFrom); fromCurrency.TextChanged += ConvertCurrency; toCurrency = FindViewById <TextView>(Resource.Id.textViewCurrencyTo); RetrieveKey(); CurrencyConverter.rate = CurrencyGetter.GetRate(leftSpinner.SelectedItem.ToString(), rightSpinner.SelectedItem.ToString()); }
void SpinnerItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { CurrencyConverter.rate = CurrencyGetter.GetRate(leftSpinner.SelectedItem.ToString(), rightSpinner.SelectedItem.ToString()); ConvertCurrency(); }
public void UpdateDatebase() { ICurrencyGetter c = new CurrencyGetter(); CurrencyBL bl = new CurrencyBL(); IEnumerable <CurrencyRate> answer = c.GetRatesSync(); //bl.addRates(answer); bl.updateRates(answer); }
static void Main(string[] args) { ICurrencyGetter c = new CurrencyGetter(); CurrencyDal dal = new CurrencyDal(); Task <IEnumerable <CurrencyRate> > answer = c.GetRates(); answer.Wait(); dal.addRates(answer.Result); }
void ConvertCurrency() { CurrencyGetter.GetRate(leftSpinner.SelectedItem.ToString(), rightSpinner.SelectedItem.ToString()); toCurrency.Text = (string.IsNullOrEmpty((fromCurrency.Text)) ? "" : CurrencyConverter.ConvertCurrency((fromCurrency.Text))); }