コード例 #1
0
ファイル: CloudSync.cs プロジェクト: MetroStar/eBriefingiOS
        private static void PushNotesWork(Book book)
        {
            List <Note> noteList = BooksOnDeviceAccessor.GetAllNotes(book.ID);

            if (noteList != null && noteList.Count > 0)
            {
                if (String.IsNullOrEmpty(URL.MultipleNoteURL))
                {
                    foreach (var note in noteList)
                    {
                        SaveMyStuff.SetMyNote(note);

                        // Remove note marked as Removed
                        if (note.Removed)
                        {
                            BooksOnDeviceAccessor.RemoveNote(note.BookID, note.PageID);
                        }
                    }
                }
                else
                {
                    SaveMyStuff.SetMyNotes(noteList);

                    // Remove notes that are marked as Removed
                    foreach (var note in noteList)
                    {
                        if (note.Removed)
                        {
                            BooksOnDeviceAccessor.RemoveNote(note.BookID, note.NoteID);
                        }
                    }
                }
            }
        }
コード例 #2
0
        private static void SendMyNotes(List <Book> bookList)
        {
            if (cancelled)
            {
                SetSent(true);

                CheckSentDone();
            }
            else
            {
                if (Reachability.IsDefaultNetworkAvailable())
                {
                    SaveMyStuff.SetMyNoteEvent += HandleSetMyNoteEvent;

                    foreach (Book book in bookList)
                    {
                        List <Note> noteList = BooksOnDeviceAccessor.GetAllNotes(book.ID);
                        if (noteList != null && noteList.Count > 0)
                        {
                            for (Int32 i = 0; i < noteList.Count; i++)
                            {
                                bool lastItem = false;
                                if (i == noteList.Count - 1)
                                {
                                    lastItem = true;
                                }

                                if (noteList[i].Removed)
                                {
                                    SaveMyStuff.RemoveMyNote(noteList[i], lastItem);
                                }
                                else
                                {
                                    SaveMyStuff.SetMyNote(noteList[i], lastItem);
                                }
                            }
                        }
                        else
                        {
                            sentNotes = true;
                        }
                    }

                    // Remove notes that are marked as removed
                    foreach (Book book in bookList)
                    {
                        List <Note> noteList = BooksOnDeviceAccessor.GetRemovedNotes(book.ID);
                        if (noteList != null && noteList.Count > 0)
                        {
                            foreach (Note note in noteList)
                            {
                                BooksOnDeviceAccessor.RemoveNote(note.BookID, note.PageID);
                            }
                        }
                    }
                }
            }
        }