예제 #1
0
        public static void UpdateDocs()
        {
            lock (docs_lock) {
                DocumentsFeed      docsFeed;
                DocumentsListQuery query = new DocumentsListQuery();
                query.Uri = new Uri(FeedUri);

                try {
                    docsFeed = service.Query(query);
                } catch (Exception e) {
                    docsFeed = null;
                    Log <GDocs> .Error(e.Message);

                    return;
                }

                docs.Clear();
                foreach (DocumentEntry doc in docsFeed.Entries)
                {
                    GDocsAbstractItem item = MaybeItemFromEntry(doc);
                    if (item != null)
                    {
                        docs.Add(item);
                    }
                }
            }
        }
예제 #2
0
        public static void TrashDocument(GDocsAbstractItem item)
        {
            // Search for document(s) having exactly the title,
            // Delete the one with matching AlternateUri
            DocumentsListQuery query = new DocumentsListQuery();

            query.Title      = item.Name;
            query.TitleExact = true;
            DocumentsFeed docFeed  = service.Query(query);
            DocumentEntry document =
                docFeed.Entries.FirstOrDefault(e => e.AlternateUri == item.URL) as DocumentEntry;

            if (document == null)
            {
                return;
            }

            try {
                document.Delete();
            } catch (Exception e) {
                Log.Error(e.Message);
                Services.Notifications.Notify(GetDeleteDocumentFailedNotification());
                return;
            }

            Services.Notifications.Notify(GetDocumentDeletedNotification(item.Name));
        }