Esempio n. 1
0
 public static void RemoveMyAnnotation(Annotation ann, bool lastItem)
 {
     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;
             }
             webService.RemoveMyPenAnnotation(ann.BookID, ann.PageID, "iOS", ann.ModifiedUtc);
         };
         worker.RunWorkerCompleted += delegate
         {
             if (SetMyAnnotationEvent != null)
             {
                 SetMyAnnotationEvent(lastItem);
             }
         };
         worker.RunWorkerAsync();
     }
     catch (Exception ex)
     {
         Logger.WriteLineDebugging("SaveMyStuff - RemoveMyAnnotation: {0}", ex.ToString());
     }
 }
Esempio n. 2
0
 public static void DeleteMyStuff()
 {
     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;
             }
             webService.DeleteMyStuff();
         };
         worker.RunWorkerAsync();
     }
     catch (Exception ex)
     {
         Logger.WriteLineDebugging("SaveMyStuff - DeleteMyStuff: {0}", ex.ToString());
     }
 }
Esempio n. 3
0
        public static SaveMyStuff_2 GenerateSaveMyStuffClient()
        {
            var client = new SaveMyStuff_2(URL.ContentSyncURL);

            if (Settings.UseFormsAuth)
            {
                client.CookieContainer = Authenticate.GetCookieContainer();
            }
            else
            {
                client.Credentials = KeychainAccessor.NetworkCredential;
            }

            return(client);
        }
Esempio n. 4
0
        public static void GetMyBooks()
        {
            try
            {
                List <Book>      bookList = null;
                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[] results = webService.GetMyBooks();

                    if (results != null && results.Length > 0)
                    {
                        bookList = new List <Book>();
                        foreach (MyBookObj mb in results)
                        {
                            Book book = GenerateBook(mb);
                            bookList.Add(book);
                        }
                    }
                };
                worker.RunWorkerCompleted += delegate
                {
                    if (GetMyBooksEvent != null)
                    {
                        GetMyBooksEvent(bookList);
                    }
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                Logger.WriteLineDebugging("SaveMyStuff - GetMyBooks: {0}", ex.ToString());
            }
        }
Esempio n. 5
0
        public static void GetMyAnnotations(String bookID, bool lastItem)
        {
            try
            {
                List <Annotation> annotationList = null;
                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;
                    }
                    PenAnnotationObj[] results = webService.GetMyPenAnnotations(bookID, "iOS");

                    if (results != null && results.Length > 0)
                    {
                        annotationList = new List <Annotation>();
                        foreach (PenAnnotationObj pa in results)
                        {
                            Annotation ann = GenerateAnnotation(pa);
                            annotationList.Add(ann);
                        }
                    }
                };
                worker.RunWorkerCompleted += delegate
                {
                    if (GetMyAnnotationsEvent != null)
                    {
                        GetMyAnnotationsEvent(bookID, annotationList, lastItem);
                    }
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                Logger.WriteLineDebugging("SaveMyStuff - GetMyAnnotations: {0}", ex.ToString());
            }
        }
Esempio n. 6
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());
            }
        }
Esempio n. 7
0
        public static void DeleteMyAnnotationsFromCloud()
        {
            SaveMyStuff_2 client = GenerateSaveMyStuffClient();

            client.DeleteMyPenAnnotations();
        }
Esempio n. 8
0
        public static void RemoveMyAnnotationFromCloud(String bookID, String pageID, DateTime modifiedUtc)
        {
            SaveMyStuff_2 client = GenerateSaveMyStuffClient();

            client.RemoveMyPenAnnotation(bookID, pageID, "iOS", modifiedUtc);
        }
Esempio n. 9
0
        public static void SetMyAnnotationToCloud(String bookID, int bookVersion, String pageID, DateTime modifiedUtc, String content)
        {
            SaveMyStuff_2 client = GenerateSaveMyStuffClient();

            client.SetMyPenAnnotation(bookID, bookVersion, pageID, "iOS", modifiedUtc, content, null);
        }
Esempio n. 10
0
        public static PenAnnotationObj[] GetMyAnnotationsFromCloud(String bookID)
        {
            SaveMyStuff_2 client = GenerateSaveMyStuffClient();

            return(client.GetMyPenAnnotations(bookID, "iOS"));
        }
Esempio n. 11
0
        public static void SetMyNoteToCloud(Note note)
        {
            SaveMyStuff_2 client = GenerateSaveMyStuffClient();

            client.SetMyTextAnnotation(note.BookID, note.BookVersion, note.PageID, note.ModifiedUtc, note.Text);
        }
Esempio n. 12
0
        public static TextAnnotationObj[] GetMyNotesFromCloud(String bookID)
        {
            SaveMyStuff_2 client = GenerateSaveMyStuffClient();

            return(client.GetMyTextAnnotations(bookID));
        }
Esempio n. 13
0
        public static void DeleteMyBookmarksFromCloud()
        {
            SaveMyStuff_2 client = GenerateSaveMyStuffClient();

            client.DeleteMyBookmarks();
        }
Esempio n. 14
0
        public static void SetMyBookmarksToCloud(BookmarkObj[] myBookmarks)
        {
            SaveMyStuff_2 client = GenerateSaveMyStuffClient();

            client.SetMyBookmarks(myBookmarks);
        }
Esempio n. 15
0
        public static BookmarkObj[] GetMyBookmarksFromCloud(String bookID)
        {
            SaveMyStuff_2 client = GenerateSaveMyStuffClient();

            return(client.GetMyBookmarks(bookID));
        }
Esempio n. 16
0
        public static MyBookObj[] GetMyBooksFromCloud()
        {
            SaveMyStuff_2 client = GenerateSaveMyStuffClient();

            return(client.GetMyBooks());
        }