Skip to content

Instantly share code, notes, and snippets.

@icebeam7
Created May 11, 2018 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icebeam7/9f767409c7c91263884cdb8e66366f0f to your computer and use it in GitHub Desktop.
Save icebeam7/9f767409c7c91263884cdb8e66366f0f to your computer and use it in GitHub Desktop.
SistemaEscolar: PaginaListaEscuelas.xaml.cs
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