private async void OnSelectedContact(Contact contact) { if (contact != null) { await AlertServices.AlertAsync("Contact", $"Número de teléfono de {contact.Name} es {string.Format("(000)-000-0000", contact.PhoneNumber)}"); } }
private async void OnAddContact() { if (!string.IsNullOrEmpty(NewContact.Name) && NewContact.PhoneNumber.Length == 10) { NewContact.FirstLetterName = NewContact.Name.Substring(0, 1).ToUpper(); Contacts.Add(NewContact); await AlertServices.AlertAsync("New contact added", $"{NewContact.Name} fue agregado como contacto"); await NavigationServices.NonModalPop(); } else { await AlertServices.AlertAsync("Error", "Faltan datos por llenar, favor revise e intente de nuevo"); } }
private async void GetActiveTeams() { var teams = await NbaApiServices.GetTeams(); if (teams.GetType().Name == "Teams") { if (teams != null) { TeamList = new ObservableCollection <Team>(teams.League.Standard); InternetConnection = true; } } else { InternetConnection = false; await AlertServices.AlertAsync("Error", "No hay conexión a internet"); } }
private async void OnEditContact() { if (!string.IsNullOrEmpty(ContactToEdit.Name) && ContactToEdit.PhoneNumber.Length == 10) { ContactToEdit.FirstLetterName = ContactToEdit.Name.Substring(0, 1).ToUpper(); Contacts.Remove(OldContact); Contacts.Add(ContactToEdit); await AlertServices.AlertAsync($"Edit contact", $"{ContactToEdit.Name} was edited"); await NavigationServices.ModalPop(); } else { await AlertServices.AlertAsync("Error", "Faltan datos por llenar, favor revise e intente de nuevo"); } }
private async void GetActivePlayers() { var players = await NbaApiServices.GetNbaPlayers(); if (players.GetType().Name == "Players") { if (players != null) { List <Player> activlePlayersList = players.League.Standard.Where(player => player.IsActive == true).ToList(); ActivePlayers = new ObservableCollection <Player>(activlePlayersList); AllActivePlayers = new ObservableCollection <Player>(activlePlayersList); InternetConnection = true; } } else { InternetConnection = false; await AlertServices.AlertAsync("Error", "No hay conexión a internet"); } }
private async void OnDeleteContact(Contact selectedContact) { Contacts.Remove(selectedContact); await AlertServices.AlertAsync("Contacto borrado", "Contacto borrado exitosamente"); }