SistemaEscolar: PaginaListaEscuelas.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Xaml; | |
using SistemaEscolar.Modelos; | |
using SistemaEscolar.Servicios; | |
namespace SistemaEscolar.Paginas | |
{ | |
[XamlCompilation(XamlCompilationOptions.Compile)] | |
public partial class PaginaListaEscuelas : ContentPage | |
{ | |
public PaginaListaEscuelas () | |
{ | |
InitializeComponent (); | |
} | |
protected async override void OnAppearing() | |
{ | |
base.OnAppearing(); | |
Loading(true); | |
var bd = new ServicioBaseDatos<Escuela>(); | |
lsvEscuelas.ItemsSource = await bd.ObtenerTabla(); | |
Loading(false); | |
} | |
void Loading(bool mostrar) | |
{ | |
indicator.IsEnabled = mostrar; | |
indicator.IsRunning = mostrar; | |
} | |
private async void lsvEscuelas_ItemSelected(object sender, SelectedItemChangedEventArgs e) | |
{ | |
try | |
{ | |
var dato = (Escuela)e.SelectedItem; | |
await Navigation.PushAsync(new PaginaEscuela(dato)); | |
lsvEscuelas.SelectedItem = null; | |
} | |
catch (Exception ex) | |
{ | |
} | |
} | |
public async void btnAgregar_Clicked(object sender, EventArgs e) | |
{ | |
await Navigation.PushAsync(new PaginaEscuela(new Escuela())); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment