static public Microsoft.Samples.FeedSync.RelatedNode CreateNew(Microsoft.Samples.FeedSync.SharingNode i_SharingNode, Microsoft.Samples.FeedSync.RelatedNode.RelatedNodeTypes i_RelatedNodeType, string i_Link, string i_Title) { Microsoft.Samples.FeedSync.Feed Feed = i_SharingNode.Feed; string ElementName = System.String.Format ( "{0}:{1}", Feed.FeedSyncNamespacePrefix, Microsoft.Samples.FeedSync.Constants.RELATED_ELEMENT_NAME ); System.Xml.XmlElement RelatedNodeXmlElement = Feed.XmlDocument.CreateElement ( ElementName, Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_URI ); string RelatedNodeType = System.String.Empty; switch (i_RelatedNodeType) { case Microsoft.Samples.FeedSync.RelatedNode.RelatedNodeTypes.Aggregated: { RelatedNodeType = Microsoft.Samples.FeedSync.Constants.RELATED_TYPE_AGGREGATED; break; } case Microsoft.Samples.FeedSync.RelatedNode.RelatedNodeTypes.Complete: { RelatedNodeType = Microsoft.Samples.FeedSync.Constants.RELATED_TYPE_COMPLETE; break; } default: { throw new System.ArgumentException("Unknown related type!"); } } RelatedNodeXmlElement.SetAttribute ( Microsoft.Samples.FeedSync.Constants.TYPE_ATTRIBUTE, RelatedNodeType ); RelatedNodeXmlElement.SetAttribute ( Microsoft.Samples.FeedSync.Constants.LINK_ATTRIBUTE, i_Link ); if (!System.String.IsNullOrEmpty(i_Title)) { RelatedNodeXmlElement.SetAttribute ( Microsoft.Samples.FeedSync.Constants.TITLE_ATTRIBUTE, i_Title ); } Microsoft.Samples.FeedSync.RelatedNode RelatedNode = new Microsoft.Samples.FeedSync.RelatedNode ( null, RelatedNodeXmlElement ); return RelatedNode; }
static public Microsoft.Samples.FeedSync.RelatedNode CreateFromXmlElement(Microsoft.Samples.FeedSync.SharingNode i_SharingNode, System.Xml.XmlElement i_RelatedNodeXmlElement) { if (i_RelatedNodeXmlElement.OwnerDocument != i_SharingNode.Feed.XmlDocument) i_RelatedNodeXmlElement = (System.Xml.XmlElement)i_SharingNode.Feed.XmlDocument.ImportNode(i_RelatedNodeXmlElement, true); Microsoft.Samples.FeedSync.RelatedNode RelatedNode = new Microsoft.Samples.FeedSync.RelatedNode ( i_SharingNode, i_RelatedNodeXmlElement ); return RelatedNode; }