本文整理汇总了C#中System.Action.CheckNotNullThrowException方法的典型用法代码示例。如果您正苦于以下问题:C# Action.CheckNotNullThrowException方法的具体用法?C# Action.CheckNotNullThrowException怎么用?C# Action.CheckNotNullThrowException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Action
的用法示例。
在下文中一共展示了Action.CheckNotNullThrowException方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadMobFoxAdResponse
public static void ReadMobFoxAdResponse(Uri rssUri, Action<List<AdWebResponse>, Exception> callback)
{
callback.CheckNotNullThrowException();
Network.GetStringFromURL(rssUri, (results, ex) =>
{
if (ex != null || results.Contains("<error>") || results.Contains("<request type=\"noAd\">"))
{
if (ex == null)
{
if (results.Contains("<error>"))
{
ex = new Exception("Publisher ID incorrect");
}
else
{
ex = new Exception("No Ad Served");
}
}
callback(null, ex);
return;
}
try
{
var xdoc = XDocument.Parse(results);
List<AdWebResponse> AdWebResponse = (from item in xdoc.Descendants("request")
select new AdWebResponse()
{
URL = item.IfNullEmptyString("clickurl"),
ImageURL = string.IsNullOrEmpty(item.IfNullEmptyString("imageurl")) ? item.ifNullHTMLImageSource("htmlString") : item.IfNullEmptyString("imageurl")
}).ToList();
callback(AdWebResponse, null);
}
catch (Exception e)
{
callback(null, e);
}
});
}
示例2: GetBlogCategories
public void GetBlogCategories(Action<List<CatFeedItem>, Exception> callback)
{
callback.CheckNotNullThrowException();
var uri = new Uri(app.SiteURL + "?feed=categories");
network.GetStringFromURL(uri, (results, ex) =>
{
if (ex != null)
callback(null, ex);
XDocument xdoc = XDocument.Parse(results);
List<CatFeedItem> catFeedItems = (from item in xdoc.Descendants("item")
select new CatFeedItem()
{
Title = item.IfNullEmptyString("title"),
ID = item.IfNullEmptyString("id"),
subTitle = ""
}).Take(10).ToList();
callback(catFeedItems, null);
});
}
开发者ID:calebjenkins,项目名称:Windows-Phone-Starter-Kit-for-WordPress,代码行数:21,代码来源:WordPressPlugInReader.cs
示例3: ReadRssComments
public void ReadRssComments(string PostId, Action<List<RSSCommentItem>, Exception> callback)
{
callback.CheckNotNullThrowException();
var uri = new Uri(string.Format("{0}?feed=get_comments_feed&post_id={1}×tamp={2}", app.SiteURL, PostId, DateTime.Now.Ticks));
network.GetStringFromURL(uri, (results, ex) =>
{
if (ex != null)
callback(null, ex);
XDocument xdoc = XDocument.Parse(results);
List<RSSCommentItem> rssCommentItems = (from item in xdoc.Descendants("item")
select new RSSCommentItem()
{
Author = item.Element("author").Value.Trim(),
Email = item.Element("email").Value.Trim(),
Comment = item.Element("comment").Value.Trim()
}).Take(30).ToList();
callback(rssCommentItems, null);
});
}
开发者ID:calebjenkins,项目名称:Windows-Phone-Starter-Kit-for-WordPress,代码行数:22,代码来源:WordPressPlugInReader.cs
示例4: ReadInnerActiveAdResponse
public static void ReadInnerActiveAdResponse(Uri rssUri, Action<List<AdWebResponse>, Exception> callback)
{
callback.CheckNotNullThrowException();
Network.GetStringFromURL(rssUri, (results, ex) =>
{
if (ex != null)
{
callback(null, ex);
return;
}
try
{
results = results.Replace("tns:", "");
var xdoc = XDocument.Parse(results);
var AdError = xdoc.Root.Attribute("Error").Value;
var AdClientID = xdoc.Root.Element("Client").FirstAttribute.Value;
List<AdWebResponse> AdWebResponse = (from item in xdoc.Descendants("Ad")
select new AdWebResponse()
{
Error = AdError,
ClientID = AdClientID,
Text = item.IfNullEmptyString("Text"),
URL = item.IfNullEmptyString("URL"),
ImageURL = item.IfNullEmptyString("Image")
}).ToList();
callback(AdWebResponse, null);
}
catch (Exception e)
{
callback(null, e);
}
});
}
示例5: ReadRss
protected internal void ReadRss(Uri rssUri, Action<List<RSSFeedItem>, Exception> callback)
{
callback.CheckNotNullThrowException();
network.GetStringFromURL(rssUri,(results, ex) =>
{
if (ex != null)
{
callback(null, ex);
return;
}
var xdoc = XDocument.Parse(results);
List<RSSFeedItem> RSSFeedItems = (from item in xdoc.Descendants("item")
select new RSSFeedItem()
{
Title = item.IfNullEmptyString("title"),
Author = item.IfNullEmptyString("author"),
Description = item.IfNullEmptyString("description"),
Tags = item.IfNullEmptyString("tags"),
ID = item.IfNullEmptyString("id"),
Date = item.IfNullEmptyString("pubDate"),
subTitle = String.Format("{0} | {1} | {2}", item.IfNullEmptyString("author"), item.IfNullEmptyString("pubDate"), item.IfNullEmptyString("tags")),
}).Take(10).ToList();
callback(RSSFeedItems, null);
});
}
开发者ID:calebjenkins,项目名称:Windows-Phone-Starter-Kit-for-WordPress,代码行数:27,代码来源:WordPressPlugInReader.cs
示例6: ReadUserinfo
public void ReadUserinfo(Action<List<UserInfo>, Exception> callback)
{
callback.CheckNotNullThrowException();
var uri = new Uri(String.Format("{0}?feed=user_info&user_id={1}datetime={2}", app.SiteURL, app.SiteAuthorBlogUserID, DateTime.Now.Ticks));
network.GetStringFromURL(uri, (results, ex) =>
{
if (ex != null)
{
callback(null, ex);
return;
}
XDocument xdoc = XDocument.Parse(results);
List<UserInfo> blogInfo = (from item in xdoc.Descendants("UserInfo")
select new UserInfo()
{
ID = item.IfNullEmptyString("UserID"),
displayName = item.IfNullEmptyString("DisplayName"),
Email = item.IfNullEmptyString("EmailAddress"),
Avatar = item.IfNullEmptyString("Gravatar"),
Bio = item.IfNullEmptyString("Bio"),
}).Take(10).ToList();
callback(blogInfo, null);
});
}
开发者ID:calebjenkins,项目名称:Windows-Phone-Starter-Kit-for-WordPress,代码行数:26,代码来源:WordPressPlugInReader.cs