本文整理汇总了C#中INotificationManager.SendNotification方法的典型用法代码示例。如果您正苦于以下问题:C# INotificationManager.SendNotification方法的具体用法?C# INotificationManager.SendNotification怎么用?C# INotificationManager.SendNotification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INotificationManager
的用法示例。
在下文中一共展示了INotificationManager.SendNotification方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetChildren
//.........这里部分代码省略.........
// Get values of syndication extension elements for a given namespace
var iTunesNamespaceUri = "http://www.itunes.com/dtds/podcast-1.0.dtd";
var yahooNamespaceUri = "http://search.yahoo.com/mrss/";
var iTunesExt = item.ElementExtensions.FirstOrDefault(x => x.OuterNamespace == iTunesNamespaceUri);
var yahooExt = item.ElementExtensions.FirstOrDefault(x => x.OuterNamespace == yahooNamespaceUri);
var iTunesNavigator = iTunesExt != null ? new XPathDocument(iTunesExt.GetReader()).CreateNavigator() : null;
var yahooNavigator = yahooExt != null ? new XPathDocument(yahooExt.GetReader()).CreateNavigator() : null;
var iTunesResolver = iTunesNavigator != null ? new XmlNamespaceManager(iTunesNavigator.NameTable) : null;
var yahooResolver = yahooNavigator != null ? new XmlNamespaceManager(yahooNavigator.NameTable) : null;
if (iTunesResolver != null) iTunesResolver.AddNamespace("itunes", iTunesNamespaceUri);
if (yahooResolver != null) yahooResolver.AddNamespace("media", yahooNamespaceUri);
// Prefer this image
//if (string.IsNullOrEmpty(podcast.PrimaryImagePath))
{
var thumbNavigator = yahooNavigator != null ? yahooNavigator.SelectSingleNode("media:thumbnail", yahooResolver) : null;
if (thumbNavigator == null && yahooNavigator != null)
{
// Some feeds bury them all inside a content element - try that
var contentNavigator = yahooNavigator.SelectSingleNode("media:content", yahooResolver);
thumbNavigator = contentNavigator.SelectSingleNode("media:thumbnail", yahooResolver);
}
var imageUrl = thumbNavigator != null ? thumbNavigator.GetAttribute("url", "") : "";
if (!string.IsNullOrEmpty(imageUrl))
{
// This will get downloaded later if we need it...
(podcast as IHasRemoteImage).RemoteImagePath = imageUrl;
}
}
var explicitNavigator = iTunesNavigator != null ? iTunesNavigator.SelectSingleNode("itunes:explicit", iTunesResolver) : null;
podcast.OfficialRating = explicitNavigator != null ? explicitNavigator.Value == "no" ? "None" : "R" : null;
//if (podcast.Name.Contains("Film")) Debugger.Break();
var durationNavigator = iTunesNavigator != null ? iTunesNavigator.SelectSingleNode("itunes:duration", iTunesResolver) : null;
var duration = durationNavigator != null ? durationNavigator.Value : String.Empty;
if (!string.IsNullOrEmpty(duration))
{
try
{
podcast.RunTimeTicks = Convert.ToInt32(duration) * TimeSpan.TicksPerSecond;
}
catch (Exception)
{
} // we don't really care
}
}
catch (Exception e)
{
notificationManager.SendNotification(new NotificationRequest
{
Description = "Error refreshing podcast item " + e,
Date = DateTime.Now,
Level = NotificationLevel.Error,
SendToUserMode = SendToUserType.Admins
}, cancellationToken);
Plugin.Logger.ErrorException("Error refreshing podcast item ", e);
}
}
// TED Talks appends the same damn string on each title, fix it
if (podcasts.Count > 5)
{
var common = podcasts[0].Name;
foreach (var video in podcasts.Skip(1))
{
while (!video.Name.StartsWith(common))
{
if (common.Length < 2)
{
break;
}
common = common.Substring(0, common.Length - 1);
}
if (common.Length < 2)
{
break;
}
}
if (common.Length > 2)
{
foreach (var video in podcasts.Where(video => video.Name.Length > common.Length))
{
video.Name = video.Name.Substring(common.Length);
}
}
}
return podcasts;
}