private async void HistoryLV_Loaded(object sender, RoutedEventArgs e) { // If the history hasn't been updated for a while, reload them from device. if (LibraryHandler.HistoryOutdated) { if (await LibraryHandler.LoadHistoryFromDevice()) { RefreshHistory(); } } else { RefreshHistory(); } }
private async void BookmarksLV_Loaded(object sender, RoutedEventArgs e) { // If the bookmarks haven't been updated for a while, reload them from device. if (LibraryHandler.BookmarksOutdated) { if (await LibraryHandler.LoadBookmarksFromDevice()) { RefreshBookmarks(); } } else { RefreshBookmarks(); } }
private async Task ShowEditBookmarkDialogue(Bookmark bookmark) { if (bookmark == null) { return; } var editContent = new EditBookmarkDialogue(); editContent.SiteName.Text = bookmark.Name; editContent.SiteUrl.Text = bookmark.URI; var editDialogue = new ContentDialog { Title = "Edit favourite", Content = editContent, PrimaryButtonText = "Save", SecondaryButtonText = "Cancel" }; // Disables the Save button if the URL is empty. editContent.TextChanged += delegate(object sender2, TextChangedEventArgs e2) { editDialogue.IsPrimaryButtonEnabled = !string.IsNullOrWhiteSpace((sender2 as TextBox).Text); }; var result = await editDialogue.ShowAsync(); if (result == ContentDialogResult.Primary) { bookmark.Name = editContent.SiteName.Text; bookmark.URI = editContent.SiteUrl.Text; RefreshBookmarks(); await LibraryHandler.SaveBookmarksToDevice(); } }