本文整理汇总了C#中Google.GData.Client.AtomEntry类的典型用法代码示例。如果您正苦于以下问题:C# AtomEntry类的具体用法?C# AtomEntry怎么用?C# AtomEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AtomEntry类属于Google.GData.Client命名空间,在下文中一共展示了AtomEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
public void Index()
{
var g = new Service("local", "application");//, "ABQIAAAACPMbozlNv9AIzNvsWUm6vhSvnLMDprvOSMH9Qt_oH5Ww7FTw1hRHT7gTSie1yM34rowNwVfw424XPA");
Assert.Fail("Need to put password here");
g.setUserCredentials("[email protected]", "zzz");
var entry = new AtomEntry();
entry.Content.ExtensionFactories.Add(new MapsExtension());
entry.Title.Text = "test";
entry.Content.Type = "application/vnd.google-earth.kml+xml";
XmlDocument doc = new XmlDocument();
doc.LoadXml(@"<Placemark xmlns='http://www.opengis.net/kml/2.2'>
<name>Faulkner's Birthplace</name>
<description/>
<Point>
<coordinates>-89.520753,34.360902,0.0</coordinates>
</Point>
</Placemark>");
entry.Content.ExtensionElements.Add(new XmlExtension((XmlNode)doc.DocumentElement));
// doc.LoadXml(@"@"<m:Placemark>
// <m:name>Faulkner's Birthplace</m:name>
// <m:description/>
// <m:Point>
// <m:coordinates>-89.520753,34.360902,0.0</m:coordinates>
// </m:Point>
//</m:Placemark>";
//entry.Content.Content = ;
//entry.AddExtension(new MapsExtension());
var m = new MemoryStream();
//var mapStuff = entry.Content.CreateExtension("PlaceMark", "http://www.opengis.net/kml/2.2");
// entry.Update();
try
{
entry.SaveToXml(m);
}
catch (Exception e)
{
var s = e.ToString();
throw;
}
m.Position = 0;
var mm = new StreamReader(m).ReadToEnd();
var q = g.Insert(new Uri("http://maps.google.com/maps/feeds/features/208433541473729117510/0004779109f86bbabd62d/full"), entry);
var p = g.Query(new Uri("http://maps.google.com/maps/feeds/maps/default/full"));
var z = new StreamReader(p).ReadToEnd();
//// Arrange
//HomeController controller = new HomeController();
//// Act
//ViewResult result = controller.Index() as ViewResult;
//// Assert
//ViewDataDictionary viewData = result.ViewData;
//Assert.AreEqual("Welcome to ASP.NET MVC!", viewData["Message"]);
}
示例2: PostNewEntry
/** Creates a new blog entry and sends it to the specified Uri */
static AtomEntry PostNewEntry(Service service, Uri blogPostUri)
{
Console.WriteLine("\nPublishing a blog post");
AtomEntry createdEntry = null;
if (blogPostUri != null)
{
// construct the new entry
AtomEntry newPost = new AtomEntry();
newPost.Title.Text = "Marriage!";
newPost.Content = new AtomContent();
newPost.Content.Content = "<div xmlns='http://www.w3.org/1999/xhtml'>" +
"<p>Mr. Darcy has <em>proposed marriage</em> to me!</p>" +
"<p>He is the last man on earth I would ever desire to marry.</p>" +
"<p>Whatever shall I do?</p>" +
"</div>";
newPost.Content.Type = "xhtml";
newPost.Authors.Add(new AtomPerson());
newPost.Authors[0].Name = "Elizabeth Bennet";
newPost.Authors[0].Email = "[email protected]";
createdEntry = service.Insert(blogPostUri, newPost);
if (createdEntry != null)
{
Console.WriteLine(" New blog post created with title: " + createdEntry.Title.Text);
}
}
return createdEntry;
}
示例3: CalendarEvent
public CalendarEvent(GoogleCalendarCredentials credentials, AtomEntry entry)
{
Invitees = new List<CalendarEventInvitee>();
Reminders = new List<CalendarEventReminder>();
_credentials = credentials;
_setContstructor((EventEntry)entry);
}
示例4: AsyncSendData
private AsyncSendData(AsyncDataHandler handler, Uri uriToUse, AtomEntry entry, AtomFeed feed,
SendOrPostCallback callback, object userData, bool parseFeed)
: base(uriToUse, null, userData, callback, parseFeed) {
this.DataHandler = handler;
this.entry = entry;
this.Feed = feed;
}
示例5: CreateAtomEntry
//////////////////////////////////////////////////////////////////////
/// <summary>creates a new, in memory atom entry</summary>
/// <returns>the new AtomEntry </returns>
//////////////////////////////////////////////////////////////////////
public static AtomEntry CreateAtomEntry(int iCount)
{
AtomEntry entry = new AtomEntry();
// some unicode chars
Char[] chars = new Char[] {
'\u0023', // #
'\u0025', // %
'\u03a0', // Pi
'\u03a3', // Sigma
'\u03d1', // beta
'&',
};
AtomPerson author = new AtomPerson(AtomPersonType.Author);
author.Name = "John Doe" + chars[0] + chars[1] + chars[2] + chars[3] + chars[4] + chars[5];
author.Email = "[email protected]";
entry.Authors.Add(author);
AtomCategory cat = new AtomCategory();
cat.Label = "Default";
cat.Term = "Default" + chars[4] + " Term";
entry.Categories.Add(cat);
entry.Content.Content = "this is the default text & entry";
entry.Content.Type = "html";
entry.Published = new DateTime(2001, 11, 20, 22, 30, 0);
entry.Title.Text = "This is a entry number: " + iCount;
entry.Updated = DateTime.Now;
return entry;
}
示例6: FeedParserEventArgs
/// <summary>constructor for the feedParser events</summary>
/// <param name="feed">the feed to use </param>
/// <param name="entry">the feedentry to use </param>
public FeedParserEventArgs(AtomFeed feed, AtomEntry entry) {
this.feedEntry = entry;
this.feed = feed;
if (feed == null && entry == null) {
this.done = true;
}
}
示例7: AddHome
public void AddHome(Home home)
{
var service = CreateService();
var entry = new AtomEntry();
entry.Title.Text = "Home Zope House";
entry.Content.Type = "application/vnd.google-earth.kml+xml";
XmlDocument doc = new XmlDocument();
string placeMark = string.Format(@"<Placemark xmlns='http://www.opengis.net/kml/2.2'>
<name>HomeZope Home</name>
<description/>
<Point>
<coordinates>{0},{1},0.0</coordinates>
</Point>
</Placemark>", home.Longitude, home.Latitude);
doc.LoadXml(placeMark);
entry.Content.ExtensionElements.Add(new XmlExtension(doc.DocumentElement));
var insertedEntry = service.Insert(new Uri("http://maps.google.com/maps/feeds/features/208433541473729117510/0004779109f86bbabd62d/full"), entry);
home.GoogleFeatureId = insertedEntry.Id.Uri.ToString();
//var m = new MemoryStream();
//insertedEntry.SaveToXml(m);
//m.Position = 0;
//var xml = new StreamReader(m).ReadToEnd();
}
示例8: AddPostLabels
private static void AddPostLabels(AtomEntry newPost, PostDetails genericPostDetails)
{
foreach (string postLabels in genericPostDetails.Labels)
{
newPost.Categories.Add(new AtomCategory(postLabels, "http://www.blogger.com/atom/ns#"));
}
}
示例9: GetPageViews
private static void GetPageViews(AtomEntry Account)
{
string ProfileID = Account.Id.AbsoluteUri.Substring(47);
DataFeedUrl = "https://www.google.com/analytics/feeds/data";
DataQuery PageViewQuery = new DataQuery(DataFeedUrl)
{
Ids = ProfileID,
Dimensions = "ga:date",
Metrics = "ga:pageviews",
Sort = "ga:date",
GAStartDate = (DateTime.Now).AddDays(-7).ToString("yyyy-MM-dd"),
GAEndDate = (DateTime.Now).ToString("yyyy-MM-dd")
};
DataFeed Results = Service.Query(PageViewQuery);
foreach (AtomEntry Result in Results.Entries)
{
DataEntry Entry = (DataEntry)Result;
Console.WriteLine(String.Format("{0}\t{1}",
Entry.Title.Text.Split('=')[1],
Entry.Metrics[0].Value));
}
}
示例10: GetSheetNames
public static AtomEntryCollection GetSheetNames(SpreadsheetsService zSpreadsheetService, AtomEntry zSheetEntry)
{
var link = zSheetEntry.Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null);
var wsquery = new WorksheetQuery(link.HRef.ToString());
var wsfeed = zSpreadsheetService.Query(wsquery);
return wsfeed.Entries;
}
示例11: UpdatedTest
public void UpdatedTest()
{
AtomEntry target = new AtomEntry();
DateTime expected = DateTime.Now;
DateTime actual;
target.Updated = expected;
actual = target.Updated;
Assert.AreEqual(expected, actual);
}
示例12: FromAtomEntry
public static Profile FromAtomEntry(AtomEntry entry)
{
Profile profile = new Profile();
profile.ID = entry.Content.Content;
profile.Name = entry.Title.Text;
profile.Authors = new List<Author>();
foreach (AtomPerson person in entry.Authors)
{
profile.Authors.Add(Author.FromAtomPerson(person));
}
return profile;
}
示例13: PublishNewEntry
public void PublishNewEntry(BlogDescriptor blogDescriptor, String title, String content)
{
if (blogDescriptor == null)
throw new ArgumentNullException("blogDescriptor");
if (String.IsNullOrEmpty(blogDescriptor.Username))
throw new ArgumentException("blogDescriptor.Username cannot be null or an empty string.");
var entry = new gClient.AtomEntry();
entry.Content.Content = content;
entry.Content.Type = "html";
entry.Title.Text = title;
var service = new gClient.Service("blogger", GoogleSucks.GetApplicationName());
service.Credentials = new gClient.GDataCredentials(blogDescriptor.Username, blogDescriptor.Password);
service.Insert(new Uri(GetFeedUri(blogDescriptor)), entry);
}
示例14: FromAtomEntry
public static Notice FromAtomEntry(AtomEntry entry)
{
Notice notice = new Notice();
notice.DatePublished = entry.Published;
notice.DateUpdated = entry.Updated;
notice.Id = entry.Id.Uri.Content;
notice.ContentType = entry.Content.Type;
notice.Content = entry.Content.Content;
notice.Subject = entry.Title.Text;
IExtensionElementFactory factory = entry.FindExtension("ContinuityOfCareRecord", "urn:astm-org:CCR");
if (factory != null)
{
XmlExtension extension = factory as XmlExtension;
XmlSerializer serializer = new XmlSerializer(typeof(ContinuityOfCareRecord));
XmlTextReader reader = new XmlTextReader(new StringReader(extension.Node.OuterXml));
notice.CareRecord = serializer.Deserialize(reader) as ContinuityOfCareRecord;
}
return notice;
}
示例15: IsEntryIdentical
/////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
/// <summary>compares two atomEntrys to see if they are identical objects</summary>
/// <param name="theOne">the first AtomEntry </param>
/// <param name="theOther">the other AtomEntry to compare with </param>
/// <returns>true if equal </returns>
//////////////////////////////////////////////////////////////////////
public static bool IsEntryIdentical(AtomEntry theOne, AtomEntry theOther)
{
Tracing.TraceMsg("Entering IsEntryIdentical");
if (theOne == null || theOther == null)
{
return theOne == theOther;
}
Tracing.TraceMsg("Comparing AuthorCollection");
if (ObjectModelHelper.IsPersonCollectionIdentical(theOne.Authors, theOther.Authors)==false)
{
return false;
}
Tracing.TraceMsg("Comparing ContributorCollection");
if (ObjectModelHelper.IsPersonCollectionIdentical(theOne.Contributors, theOther.Contributors)==false)
{
return false;
}
Tracing.TraceMsg("Comparing CategoryCollection");
if (ObjectModelHelper.IsCategoryCollectionIdentical(theOne.Categories, theOther.Categories)==false)
{
return false;
}
Tracing.TraceMsg("Comparing LinkCollection");
if (ObjectModelHelper.IsLinkCollectionIdentical(theOne.Links, theOther.Links)==false)
{
return false;
}
Tracing.TraceMsg("Comparing Content");
if (ObjectModelHelper.IsContentIdentical(theOne.Content, theOther.Content)==false)
{
return false;
}
Tracing.TraceMsg("Comparing Source");
if (ObjectModelHelper.IsSourceIdentical(theOne.Source, theOther.Source)==false)
{
return false;
}
Tracing.TraceMsg("Comparing Summary");
if (ObjectModelHelper.IsTextConstructIdentical(theOne.Summary, theOther.Summary)==false)
{
return false;
}
Tracing.TraceMsg("Comparing Title");
if (ObjectModelHelper.IsTextConstructIdentical(theOne.Title, theOther.Title)==false)
{
return false;
}
Tracing.TraceMsg("Comparing Rights");
if (ObjectModelHelper.IsTextConstructIdentical(theOne.Rights, theOther.Rights)==false)
{
return false;
}
Tracing.TraceMsg("Comparing BaseLink");
if (ObjectModelHelper.IsBaseLinkIdentical(theOne.Id, theOther.Id)==false)
{
return false;
}
/*
if (System.DateTime.Compare(theOne.Published, theOther.Published) != 0)
{
return false;
}
if (System.DateTime.Compare(theOne.Updated,theOther.Updated) != 0)
{
return false;
}
*/
Tracing.TraceMsg("Exiting IsEntryIdentical");
return true;
}