internal SyncWorkItem(ODataOperation op, Bookmark bookmark, int serverId)
        {
            if (bookmark == null)
                throw new ArgumentNullException("bookmark");

            this.Operation = op;
            this.Bookmark = bookmark;
            this.ServerId = serverId;
        }
        private void ConfigureBookmark(Bookmark bookmark)
        {
            if (bookmark == null)
                throw new ArgumentNullException("bookmark");

            // button...
            Button button = GetButton(bookmark.Ordinal);
            if (button == null)
                throw new InvalidOperationException("'button' is null.");

            // set...
            button.Text = bookmark.Name;
        }
        private void GetLatest()
        {
            Debug.WriteLine("Getting latest...");

            BookmarksService service = new BookmarksService();
            service.GetAll((Action<List<Bookmark>>)delegate(List<Bookmark> bookmarks)
            {
                // ensure...
                SqlCeHelper db = new SqlCeHelper();
                db.EnsureTableExists(EntityType.GetEntityType(typeof(Bookmark)));

                // delete first...
                Bookmark.DeleteAll();

                // go through and save them...
                foreach (Bookmark fromServer in bookmarks)
                {
                    // we need to clone it as the ones that come from the server will have an id set.  we
                    // need to junk this id...
                    Bookmark newBookmark = new Bookmark();
                    newBookmark.Ordinal = fromServer.Ordinal;
                    newBookmark.Name = fromServer.Name;
                    newBookmark.Url = fromServer.Url;

                    // set the local only stuff...
                    newBookmark.IsLocalModified = false;
                    newBookmark.IsLocalDeleted = false;

                    // save...
                    newBookmark.SaveChanges();
                }

                // signal that we've finished...
                this.Callback();

            }, this.Failed);
        }