Exemplo n.º 1
0
        private static void PushBookmarksWork(Book book)
        {
            List <Bookmark> bookmarkList = BooksOnDeviceAccessor.GetAllBookmarks(book.ID);

            if (bookmarkList != null && bookmarkList.Count > 0)
            {
                SaveMyStuff.SetMyBookmarks(bookmarkList);

                // Remove bookmarks that are marked as Removed
                foreach (var bookmark in bookmarkList)
                {
                    if (bookmark.Removed)
                    {
                        BooksOnDeviceAccessor.RemoveBookmark(bookmark.BookID, bookmark.PageID);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private static void SendMyBookmarks(List <Book> bookList)
        {
            if (cancelled)
            {
                SetSent(true);

                CheckSentDone();
            }
            else
            {
                if (Reachability.IsDefaultNetworkAvailable())
                {
                    SaveMyStuff.SetMyBookmarksEvent += HandleSetMyBookmarksEvent;

                    foreach (Book book in bookList)
                    {
                        List <Bookmark> bookmarkList = BooksOnDeviceAccessor.GetAllBookmarks(book.ID);
                        if (bookmarkList != null && bookmarkList.Count > 0)
                        {
                            SaveMyStuff.SetMyBookmarks(bookmarkList);
                        }
                        else
                        {
                            sentBookmarks = true;
                        }
                    }

                    // Remove bookmarks that are marked as removed
                    foreach (Book book in bookList)
                    {
                        List <Bookmark> bookmarkList = BooksOnDeviceAccessor.GetRemovedBookmarks(book.ID);
                        if (bookmarkList != null && bookmarkList.Count > 0)
                        {
                            foreach (Bookmark bookmark in bookmarkList)
                            {
                                BooksOnDeviceAccessor.RemoveBookmark(bookmark.BookID, bookmark.PageID);
                            }
                        }
                    }
                }
            }
        }