internal Document LoadGoogleNotes(string folderUri, AtomId id) { string message = "Error Loading Google Notes. Cannot connect to Google.\r\nPlease ensure you are connected to the internet. If you are behind a proxy, change your proxy configuration!"; Document ret = null; try { if (folderUri == null && id == null) { // Only log, if not specific Google Notes are searched Logger.Log("Loading Google Notes...", EventType.Information); GoogleNotes = new Collection<Document>(); } if (googleNotesFolder == null) googleNotesFolder = GetOrCreateGoogleFolder(null, "Notes");//ToDo: Make the folder name Notes configurable in SettingsForm, for now hardcode to "Notes"); if (folderUri == null) { if (id == null) folderUri = googleNotesFolder.DocumentEntry.Content.AbsoluteUri; else //if newly created folderUri = DocumentsRequest.BaseUri; } DocumentQuery query = new DocumentQuery(folderUri); query.Categories.Add(new QueryCategory(new AtomCategory("document"))); query.NumberToRetrieve = 256; query.StartIndex = 0; //query.ShowDeleted = false; //query.OrderBy = "lastmodified"; Feed<Document> feed = DocumentsRequest.Get<Document>(query); while (feed != null) { foreach (Document a in feed.Entries) { if (id == null) GoogleNotes.Add(a); else if (id.Equals(a.DocumentEntry.Id)) { ret = a; return ret; } } query.StartIndex += query.NumberToRetrieve; feed = DocumentsRequest.Get<Document>(feed, FeedRequestType.Next); } } catch (System.Net.WebException ex) { //Logger.Log(message, EventType.Error); throw new GDataRequestException(message, ex); } catch (System.NullReferenceException ex) { //Logger.Log(message, EventType.Error); throw new GDataRequestException(message, new System.Net.WebException("Error accessing feed", ex)); } return ret; }
private Contact LoadGoogleContacts(AtomId id) { string message = "Error Loading Google Contacts. Cannot connect to Google.\r\nPlease ensure you are connected to the internet. If you are behind a proxy, change your proxy configuration!"; Contact ret = null; try { if (id == null) // Only log, if not specific Google Contacts are searched Logger.Log("Loading Google Contacts...", EventType.Information); GoogleContacts = new Collection<Contact>(); ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("default")); query.NumberToRetrieve = 256; query.StartIndex = 0; //Only load Google Contacts in My Contacts group (to avoid syncing accounts added automatically to "Weitere Kontakte"/"Further Contacts") Group group = GetGoogleGroupByName(myContactsGroup); if (group != null) query.Group = group.Id; //query.ShowDeleted = false; //query.OrderBy = "lastmodified"; Feed<Contact> feed = ContactsRequest.Get<Contact>(query); while (feed != null) { foreach (Contact a in feed.Entries) { GoogleContacts.Add(a); if (id != null && id.Equals(a.ContactEntry.Id)) ret = a; } query.StartIndex += query.NumberToRetrieve; feed = ContactsRequest.Get<Contact>(feed, FeedRequestType.Next); } } catch (System.Net.WebException ex) { //Logger.Log(message, EventType.Error); throw new GDataRequestException(message, ex); } catch (System.NullReferenceException ex) { //Logger.Log(message, EventType.Error); throw new GDataRequestException(message, new System.Net.WebException("Error accessing feed", ex)); } return ret; }
public void EqualsTest() { AtomId a = new AtomId("www.a.com"); AtomId b = new AtomId("www.b.com"); bool expected = false; // TODO: Initialize to an appropriate value bool actual; actual = a.Equals(b); Assert.AreEqual(expected, actual); }