private async void Apply_Clicked(object sender, EventArgs e) { ; bool result = false; if ((codI != "" && passI != "" && userI != "") || (codA != "" && passA != "" && userA != "")) { switch (Device.RuntimePlatform) { case Device.Android: Utente u = new Utente(userA, passA, codA); result = await ControlloCodice.cambiaCodice(u); break; case Device.iOS: Utente f = new Utente(userI, passI, codI); result = await ControlloCodice.cambiaCodice(f); break; } if (result) { await DisplayAlert("Fondomerende", "il Codice è stato cambiato con successo", "Ok"); } else { await DisplayAlert("Fondomerende", "Impossibile cambiare il codice", "Ok"); } } else { await DisplayAlert("Fondomerende", "Inserire tutti i campi", "Ok"); } }
private async void Apply_Clicked(object sender, EventArgs e) { ; bool result = false; if ((codI != "" && passI != "" && userI != "") || (codA != "" && passA != "" && userA != "")) { switch (Device.RuntimePlatform) { case Device.Android: Utente u = new Utente(userA, passA, codA); result = await ControlloCodice.AggiungiUtente(u); break; case Device.iOS: Utente f = new Utente(userI, passI, codI); result = await ControlloCodice.AggiungiUtente(f); break; } if (result) { await DisplayAlert("Fondomerende", "L'utente è stato aggiunto con successo", "Ok"); } else { await DisplayAlert("Fondomerende", "L'utente è gia presente o il codice è gia stato scelto o l'utente non esiste", "Ok"); } } else { await DisplayAlert("Fondomerende", "Inserire tutti i campi", "Ok"); } }
public TabletPage() { ControlloCodice c = new ControlloCodice(); InitializeComponent(); switch (Device.RuntimePlatform) // ||\\ { // || \\ // || \\ Se il dispositivo è Android non mostra la Top Bar della Navigation Page, case Device.Android: // \\ || \\ Se è iOS invece si (perchè senza è una schifezza) NavigationPage.SetHasNavigationBar(this, false); // \\ || \\ \ break; // ||||||||||||||||\/\/| | // || // / default: // || // NavigationPage.SetHasNavigationBar(this, false); // || // break; // || // } }
private async void Apply_Clicked(object sender, EventArgs e) { bool result = false; if (codiceAndroid.Text != "" || codiceAndroid.Text != null || codiceiOS.Text != "" || codiceiOS.Text != null) { switch (Device.RuntimePlatform) { case Device.Android: result = await ControlloCodice.checkBeforeAction(codiceAndroid.Text); break; case Device.iOS: result = await ControlloCodice.checkBeforeAction(codiceiOS.Text); break; } if (result) { switch (mod) { case "mangia": SnackServiceManager a = new SnackServiceManager(); SnackDataDTO elemento = (SnackDataDTO)index; var scelta = await DisplayAlert("Fondomerende", "Sicuro di voler mangiare " + elemento.friendly_name + "?", "Si", "No"); if (scelta) { var risposta = await a.EatAsync(elemento.id, 1); if (risposta.success) { await DisplayAlert("Fondomerende", "Snack mangiato", "Ok"); } else { await DisplayAlert("Fondomerende", "Snack non mangiato", "Ok"); } await PopupNavigation.Instance.PopAsync(); } else { await PopupNavigation.Instance.PopAsync(); } break; ////////////////////////////////////////////////////////// case "deposita": DepositServiceManager d = new DepositServiceManager(); string app = (string)index; var resultDep = await d.DepositAsync(app); if (resultDep != null) { if (resultDep.success) { await DisplayAlert("Fondomerende", "Soldi depositati con successo", "Ok"); if (Device.RuntimePlatform == Device.iOS) { DependencyService.Get <HapticFeedbackGen>().HapticFeedbackGenSuccessAsync(); } else { Vibration.Vibrate(40); await Task.Delay(100); Vibration.Vibrate(40); } await PopupNavigation.Instance.PopAsync(); } else { await DisplayAlert("Fondomerende", "I soldi non sono stati depositati", "Ok"); }; } else { await PopupNavigation.Instance.PopAsync(); } break; ///////////////////////////////////////////////// case "compra": int id = (int)index; int quantita = (int)aggiunta; bool swap = (bool)aggiunta4; SnackServiceManager x = new SnackServiceManager(); if (!swap) { var risp = await x.BuySnackAsync(id, quantita); if (risp != null) { if (risp.success) { MessagingCenter.Send(new AllSnacksPage() { }, "RefreshGetSnacks"); Vibration.Vibrate(40); await Task.Delay(100); Vibration.Vibrate(40); MessagingCenter.Send(new AllSnacksPage() { }, "RefreshGriglia"); await DisplayAlert("Fondo Merende", "Lo snack è stato comprato", "Ok"); await PopupNavigation.Instance.PopAsync(); } else { await DisplayAlert("Fondo Merende", risp.message, "Ok"); } } } else { string prezzo = (string)aggiunta2; string scadenza = (string)aggiunta3; var risp = await x.BuySnackAsync2(id, quantita, prezzo, scadenza); if (risp != null) { if (risp.success) { MessagingCenter.Send(new AllSnacksPage() { }, "RefreshGetSnacks"); Vibration.Vibrate(40); await Task.Delay(100); Vibration.Vibrate(40); MessagingCenter.Send(new AllSnacksPage() { }, "RefreshGriglia"); await DisplayAlert("Fondo Merende", "Lo snack è stato comprato", "Ok"); await PopupNavigation.Instance.PopAsync(); } else { await DisplayAlert("Fondo Merende", risp.message, "Ok"); } } } break; /////////////////////////////////////////// } } else { await DisplayAlert("Fondomerende", "Codice non presente", "Ok"); } } else { await DisplayAlert("Fondomerende", "Inserire il codice", "Ok"); } ControlloCodice.fineAzioni(); }