Пример #1
0
 private void GetLabel(ReaderServiceAsync rdr)
 {
     rdr.GetLabel("ALT.net",
                new ReaderFeedParameters {Direction = ItemDirection.Descending, MaxItems = 20},
                items =>
                    {
                        foreach (var item in items)
                        {
                            this.Items.Add(new ItemViewModel()
                                               {
                                                   LineOne = item.Title,
                                                   LineTwo = "by " + item.Author,
                                                   LineThree = item.GetContent().Content
                                               });
                        }
                    },
                ex =>
                    {
                        this.Items.Add(new ItemViewModel{LineOne = "Error", LineTwo = ex.Message, LineThree = "so not cool!!"});
                    },
                () => this.IsDataLoaded = true);
 }
Пример #2
0
 private static void TestGetLabel(ReaderServiceAsync rdr)
 {
     rdr.GetLabel("ALT.net", new ReaderFeedParameters { Direction = ItemDirection.Default, MaxItems = 5},
                     items =>
                         {
                             foreach (var item in items)
                             {
                                 Console.WriteLine(item.Blog.Title + " : " + item.Title + " by " + item.Author);
                             }
                         },
                     ex =>
                         {
                             if (ex is LoginFailedException)
                             {
                                 PerformLogin(rdr, () => TestGetLabel(rdr));
                             }
                             else if (ex is NetworkConnectionException)
                             {
                                 Console.WriteLine(ex.Message);
                             }
                             else if (ex is GoogleResponseException)
                             {
                                 Console.WriteLine(
                                     String.Format("There was a problem with the connection: {0}, {1}",
                                                   ((GoogleResponseException) ex).StatusCode, ex.Message));
                             }
                         },
                     () => Console.WriteLine("Press [ENTER] to close"));
 }