async private void AddOutflows(object sender, EventArgs e) { //tutti i campi devono essere compilati if (String.Equals(OutflowsCategory.SelectedItem, null) || String.IsNullOrEmpty(money.Text)) { await App.Current.MainPage.DisplayAlert("Error", "Try Again", "OK"); } else if (!IsDigitsOnly(money.Text)) { await App.Current.MainPage.DisplayAlert("Error", "Insert only digits, dot or comma", "OK"); } else { string category = OutflowsCategory.SelectedItem.ToString(); string moneyTrans = money.Text.Replace(',', '.'); //se valore contiene virgola viene sostituita string task = await firestore.AddTransaction2(category, moneyTrans); if (String.Equals(task, "ok")) { App.Current.MainPage = new MainPage(); } else { await App.Current.MainPage.DisplayAlert("Error", "Try Again", "OK"); } } }