private void PopupConfirmation(object sender, EventArgs e) { popupDialog = new Dialog(this); popupDialog.SetContentView(Resource.Layout.fragment_confirmation); popupDialog.Window.SetSoftInputMode(SoftInput.AdjustResize); popupDialog.Show(); TextView textDate = popupDialog.FindViewById <TextView>(Resource.Id.confirmationDay); TextView textHour = popupDialog.FindViewById <TextView>(Resource.Id.confirmationHour); TextView textQuantity = popupDialog.FindViewById <TextView>(Resource.Id.confirmationQuantity); Button buttonOk = popupDialog.FindViewById <Button>(Resource.Id.buttonConfirmation); textDate.Text = editTextDate.Text; textHour.Text = spinner.SelectedItem.ToString(); textQuantity.Text = spinnerQuantity.SelectedItem.ToString(); buttonOk.Click += async delegate { popupDialog.Dismiss(); popupDialog.Hide(); DateTime dateTime = Convert.ToDateTime($"{textDate.Text} {textHour.Text}:00"); Match match = Regex.Match(textQuantity.Text, "([0-9][0-9])"); var response = await API.NewReservation(idRestaurant, Preferences.Get("idUser", 0), dateTime, int.Parse(match.Value)); if (response == "\"1\"") { API.FireAndForgetQRAsync(Preferences.Get("idUser", 0)); Preferences.Set("boolReservation", false); if (Preferences.Get("boolNFPush", true)) { CrossLocalNotifications.Current.Show("Reservación próxima", $"Queremos recordarte de tu reservación a las {textHour}.", 0, dateTime - new TimeSpan(4, 0, 0)); CrossLocalNotifications.Current.Show("Reservación para mañana", $"Queremos recordarte de tu reservación para mañana a las {textHour}.", 0, dateTime - new TimeSpan(1, 0, 0, 0)); } response = "Tu reservación se ha generado con éxito."; } Toast.MakeText(this, response, ToastLength.Long).Show(); Finish(); }; }