当前位置: 首页>>代码示例>>C#>>正文


C# Action.CheckNotNullThrowException方法代码示例

本文整理汇总了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);
                }
            });
        }
开发者ID:jandujar,项目名称:AdrotatorV2,代码行数:42,代码来源:AdWebRequest.cs

示例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}&timestamp={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);
                }
            });
        }
开发者ID:jandujar,项目名称:AdrotatorV2,代码行数:36,代码来源:AdWebRequest.cs

示例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


注:本文中的System.Action.CheckNotNullThrowException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。