public static ITunesSyndicationExtensionContext CreateContext1() { var nyc = new ITunesSyndicationExtensionContext(); //nyc.Latitude = 40; //nyc.Longitude = -74; return nyc; }
/// <summary> /// Initializes the optional syndication extension information using the supplied <see cref="XPathNavigator"/>. /// </summary> /// <param name="source">The <b>XPathNavigator</b> used to load this <see cref="ITunesSyndicationExtensionContext"/>.</param> /// <param name="manager">The <see cref="XmlNamespaceManager"/> object used to resolve prefixed syndication extension elements and attributes.</param> /// <returns><b>true</b> if the <see cref="ITunesSyndicationExtensionContext"/> was able to be initialized using the supplied <paramref name="source"/>; otherwise <b>false</b>.</returns> /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception> /// <exception cref="ArgumentNullException">The <paramref name="manager"/> is a null reference (Nothing in Visual Basic).</exception> private bool LoadOptionals(XPathNavigator source, XmlNamespaceManager manager) { bool wasLoaded = false; Guard.ArgumentNotNull(source, "source"); Guard.ArgumentNotNull(manager, "manager"); if (source.HasChildren) { XPathNavigator blockNavigator = source.SelectSingleNode("itunes:block", manager); XPathNavigator imageNavigator = source.SelectSingleNode("itunes:image", manager); XPathNavigator durationNavigator = source.SelectSingleNode("itunes:duration", manager); XPathNavigator explicitNavigator = source.SelectSingleNode("itunes:explicit", manager); if (blockNavigator != null && !String.IsNullOrEmpty(blockNavigator.Value)) { if (String.Compare(blockNavigator.Value, "yes", StringComparison.OrdinalIgnoreCase) == 0) { this.IsBlocked = true; wasLoaded = true; } else if (String.Compare(blockNavigator.Value, "no", StringComparison.OrdinalIgnoreCase) == 0) { this.IsBlocked = false; wasLoaded = true; } } if (imageNavigator != null && imageNavigator.HasAttributes) { string hrefAttribute = imageNavigator.GetAttribute("href", String.Empty); if (!String.IsNullOrEmpty(hrefAttribute)) { Uri image; if (Uri.TryCreate(hrefAttribute, UriKind.RelativeOrAbsolute, out image)) { this.Image = image; wasLoaded = true; } } } if (durationNavigator != null && !String.IsNullOrEmpty(durationNavigator.Value)) { TimeSpan duration = ITunesSyndicationExtensionContext.ParseDuration(durationNavigator.Value); if (duration != TimeSpan.MinValue) { this.Duration = duration; wasLoaded = true; } } if (explicitNavigator != null && !String.IsNullOrEmpty(explicitNavigator.Value)) { ITunesExplicitMaterial explicitMaterial = ITunesSyndicationExtension.ExplicitMaterialByName(explicitNavigator.Value.Trim()); if (explicitMaterial != ITunesExplicitMaterial.None) { this.ExplicitMaterial = explicitMaterial; wasLoaded = true; } } } return(wasLoaded); }