private static void SendMyAnnotations(List <Book> bookList) { if (cancelled) { SetSent(true); CheckSentDone(); } else { if (Reachability.IsDefaultNetworkAvailable()) { SaveMyStuff.SetMyAnnotationEvent += HandleSetMyAnnotationEvent; foreach (Book book in bookList) { List <Annotation> annotationList = BooksOnDeviceAccessor.GetAllAnnotations(book.ID); if (annotationList != null && annotationList.Count > 0) { for (Int32 i = 0; i < annotationList.Count; i++) { bool lastItem = false; if (i == annotationList.Count - 1) { lastItem = true; } if (annotationList[i].Removed) { SaveMyStuff.RemoveMyAnnotation(annotationList[i], lastItem); } else { SaveMyStuff.SetMyAnnotation(annotationList[i], lastItem); } } } else { sentAnnotations = true; } } // Remove annotation that are marked as removed foreach (Book book in bookList) { List <Annotation> annotationList = BooksOnDeviceAccessor.GetRemovedAnnotations(book.ID); if (annotationList != null && annotationList.Count > 0) { foreach (Annotation annotation in annotationList) { BooksOnDeviceAccessor.RemoveAnnotation(annotation.BookID, annotation.PageID); } } } } } }
private static void PushAnnotationsWork(Book book) { List <Annotation> annList = BooksOnDeviceAccessor.GetAllAnnotations(book.ID); if (annList != null && annList.Count > 0) { foreach (var ann in annList) { if (ann.Removed) { SaveMyStuff.RemoveMyAnnotation(ann); // Remove annotations that are marked as Removed BooksOnDeviceAccessor.RemoveAnnotation(ann.BookID, ann.PageID); } else { SaveMyStuff.SetMyAnnotation(ann); } } } }