예제 #1
0
        public static async Task <bool> LoadBookmarksFromDevice(bool refresh = false)
        {
            if (refresh)
            {
                Bookmarks.Clear(true);
            }

            if (await Utilities.IsFilePresent(bookmarksPath))
            {
                try
                {
                    var storedBookmarks = await Utilities.DeserialiseJson <List <Bookmark> >(bookmarksPath).ConfigureAwait(false);

                    Bookmarks.AddRange(storedBookmarks);
                }
                catch (Exception)
                {
                    Console.WriteLine("No Bookmarks found on device.");
                }
            }
            else
            {
                Bookmarks.AddRange(new List <Bookmark>()
                {
                    new Bookmark("Bing", "https://bing.com/", DateTime.UtcNow),
                    new Bookmark("Google", "https://google.com/", DateTime.UtcNow),
                    new Bookmark("DuckDuckGo", "https://duckduckgo.com/", DateTime.UtcNow),
                    new Bookmark("YouTube", "https://youtube.com/", DateTime.UtcNow),
                    new Bookmark("Twitch", "https://twitch.tv/", DateTime.UtcNow),
                    new Bookmark("Xbox", "https://xbox.com/", DateTime.UtcNow),
                    new Bookmark("Steam", "https://steampowered.com/", DateTime.UtcNow),
                    new Bookmark("New Features", "::/newfeatures", DateTime.UtcNow)
                });
            }

            nextBookmarkLoad = DateTime.UtcNow.AddMinutes(1);

            return(true);
        }
예제 #2
0
 public static async Task SaveBookmarksToDevice()
 {
     await Utilities.SerialiseJson(bookmarksPath, await Bookmarks.GetBookmarks().ConfigureAwait(false)).ConfigureAwait(false);
 }