Esempio n. 1
0
        private async void ReadRss(IAsyncResult result)
        {
            HttpWebRequest request = result.AsyncState as HttpWebRequest;
            HttpWebResponse response = request.EndGetResponse(result) as HttpWebResponse;
            List<NewsItem> NewsItemsNew = new List<NewsItem>();


            using (Stream stream = response.GetResponseStream())
            {
                XmlSerializer serializer = new XmlSerializer(typeof(Rss));
                Rss rss = (Rss)serializer.Deserialize(stream);

                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    for (int i = 0; i <6; i++)
                    {

                        NewsItem n = new NewsItem();

                        n.pubDate = rss.Channel.NewsItems[i].pubDate;
                        n.Description = "";
                        desc.Add(rss.Channel.NewsItems[i].Description);
                        n.Title = rss.Channel.NewsItems[i].Title;
                        n.setDATE();
                        n.Prikaz = "";

                        
                        string d = desc[i];
                        desc.RemoveAt(i);
                        List<string> des_link=ocistiDescription(ref d);
                        desc.Add((des_link[0]));
                        n.link = "";
                        n.Vidljivost=Visibility.Collapsed;
                        if (des_link.Count > 1) { n.link = des_link[1]; n.Prikaz = "Прикажи ПДФ"; }
                        
                        
                        lista.Items.Add(n);
                    }
                    //rss.Channel.NewsItems = NewsItemsNew;
                    //this.ViewModel.CurrentRss = rss;
                                

                });
            }

        }