public NoteList() { InitializeComponent(); ToolbarItem addItem = null; ToolbarItem showUndoneItem = null; ToolbarItem showAllItem = null; ToolbarItem showDoneItem = null; addItem = new ToolbarItem("Add", "add.png", () => { var note = new Note(); var notePage = new NotePage(); notePage.BindingContext = note; Navigation.PushAsync(notePage); }, ToolbarItemOrder.Primary, 0); showUndoneItem = new ToolbarItem("Not done notes", "plus", () => { listView.ItemsSource = App.Database.GetItemsNotDone(); }, ToolbarItemOrder.Secondary, 0); showDoneItem = new ToolbarItem("Done notes", "plus", () => { listView.ItemsSource = App.Database.GetItemsDone(); }, ToolbarItemOrder.Secondary, 0); showAllItem = new ToolbarItem("All", "plus", () => { listView.ItemsSource = App.Database.GetItems(); }, ToolbarItemOrder.Secondary, 0); ToolbarItems.Add(addItem); ToolbarItems.Add(showUndoneItem); ToolbarItems.Add(showDoneItem); ToolbarItems.Add(showAllItem); }
void listItemSelected(object sender, SelectedItemChangedEventArgs e) { var note = (Note) e.SelectedItem; var notePage = new NotePage(); notePage.BindingContext = note; ((App) App.Current).ResumeNote = note.Id; Navigation.PushAsync(notePage); }
protected override void OnStart() { if (Properties.ContainsKey("ResumeNote")) { var resumePoint = Properties["ResumeNote"].ToString(); if (!String.IsNullOrEmpty(resumePoint)) { ResumeNote = int.Parse(resumePoint); if (ResumeNote >= 0) { var notePage = new NotePage(); notePage.BindingContext = Database.GetItem(ResumeNote); MainPage.Navigation.PushAsync(notePage, false); } } } }