Esempio n. 1
0
        private static MyBookObj GenerateBookObj(Book book)
        {
            MyBookObj mb = new MyBookObj();

            mb.BookId      = book.ID;
            mb.BookVersion = book.Version;
            mb.IsFavorite  = book.IsFavorite;
            mb.ModifiedUtc = book.UserModifiedDate;
            mb.Removed     = book.Removed;

            return(mb);
        }
Esempio n. 2
0
        private static Book GenerateBook(MyBookObj mb)
        {
            Book book = new Book();

            book.ID               = mb.BookId;
            book.Version          = mb.BookVersion;
            book.IsFavorite       = mb.IsFavorite;
            book.UserModifiedDate = mb.ModifiedUtc;
            book.Removed          = mb.Removed;

            return(book);
        }
Esempio n. 3
0
        public static void SetMyBooks(List <Book> bookList)
        {
            try
            {
                MyBookObj[] myBooks = new MyBookObj[bookList.Count];
                for (int i = 0; i < bookList.Count; i++)
                {
                    MyBookObj mb = GenerateBookObj(bookList[i]);
                    myBooks[i] = mb;
                }

                eBriefingService.SetMyBooksToCloud(myBooks);
            }
            catch (Exception ex)
            {
                Logger.WriteLineDebugging("SaveMyStuff - SetMyBooks: {0}", ex.ToString());
            }
        }
Esempio n. 4
0
        public static void SetMyBooks(List <Book> bookList)
        {
            try
            {
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += delegate
                {
                    SaveMyStuff_2 webService = new SaveMyStuff_2(Server.GenerateContentSyncURL(Settings.ServerURL));
                    if (Settings.UseFormsAuth)
                    {
                        webService.CookieContainer = Authenticate.GetCookieContainer();
                    }
                    else
                    {
                        webService.Credentials = KeychainAccessor.NetworkCredential;
                    }

                    MyBookObj[] myBooks = new MyBookObj[bookList.Count];
                    for (Int32 i = 0; i < bookList.Count; i++)
                    {
                        MyBookObj mb = GenerateBookObj(bookList[i]);
                        myBooks[i] = mb;
                    }

                    webService.SetMyBooks(myBooks);
                };
                worker.RunWorkerCompleted += delegate
                {
                    if (SetMyBooksEvent != null)
                    {
                        SetMyBooksEvent();
                    }
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                Logger.WriteLineDebugging("SaveMyStuff - SetMyBooks: {0}", ex.ToString());
            }
        }