public MainView() { String title = "H.A.V.O. Main Menu"; String listaNueva = "New List"; String listaCargar = "Select List"; String documento = "Create document"; this.SetBinding(ContentPage.TitleProperty, title); Title = title; var nuevaLista = new Button { Text = listaNueva }; nuevaLista.Clicked += (sender, e) => { var lista = new Lista(); var listaCreatePage = new ListaCreatePage(); ///lista.UserID; listaCreatePage.BindingContext = lista; Navigation.PushAsync(listaCreatePage); }; var cargarListas = new Button { Text = listaCargar }; cargarListas.Clicked += (sender, e) => { var listas = App.Database.getListas(); var listingListas = new ListingListas(); listingListas.BindingContext = listas; Navigation.PushAsync(listingListas); }; var crearDocumento = new Button { Text = documento }; crearDocumento.Clicked += (sender, e) => { DisplayAlert("There is a problem", "This part of the app is still pending, sorry", "OK"); }; Content = new StackLayout { VerticalOptions = LayoutOptions.CenterAndExpand, Padding = new Thickness(20), Children = { nuevaLista, cargarListas, crearDocumento } }; }
public ListingListas() { Title = "Showing List"; NavigationPage.SetHasNavigationBar(this, true); listView = new ListView { RowHeight = 40, ItemTemplate = new DataTemplate(typeof(ItemCell)) }; listView.SeparatorVisibility = SeparatorVisibility.Default; listView.SeparatorColor = Color.White; listView.ItemSelected += (sender, e) => { var lista = (Lista)e.SelectedItem; var taskListing = new ListingTasks(lista.ID, true); Navigation.PushAsync(taskListing); }; var layout = new StackLayout(); if (Device.OS == TargetPlatform.WinPhone) { // WinPhone doesn't have the title showing layout.Children.Add(new Label { FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), FontAttributes = FontAttributes.Bold }); } layout.Children.Add(listView); layout.VerticalOptions = LayoutOptions.FillAndExpand; Content = layout; ToolbarItem tbi = null; if (Device.OS == TargetPlatform.iOS) { tbi = new ToolbarItem("+", null, () => { var lista = new Lista(); var listaCreatePage = new ListaCreatePage(); listaCreatePage.BindingContext = lista; Navigation.PushAsync(listaCreatePage); }, 0, 0); } if (Device.OS == TargetPlatform.Android) { // BUG: Android doesn't support the icon being null tbi = new ToolbarItem("+", "plus", () => { var lista = new Lista(); var listaCreatePage = new ListaCreatePage(); listaCreatePage.BindingContext = lista; Navigation.PushAsync(listaCreatePage); }, 0, 0); } if (Device.OS == TargetPlatform.WinPhone) { tbi = new ToolbarItem("Add", "add.png", () => { var lista = new Lista(); var listaCreatePage = new ListaCreatePage(); listaCreatePage.BindingContext = lista; Navigation.PushAsync(listaCreatePage); }, 0, 0); } ToolbarItems.Add(tbi); }