示例#1
0
        public async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            var httpClient = new HttpClient();

            try
            {
                var feed           = "https://www.lebensmittelwarnung.de/bvl-lmw-de/opensaga/feed/alle/alle_bundeslaender.rss";
                var responseString = await httpClient.GetStringAsync(feed);

                FeedItems.Clear();
                var items = await ParseFeed(responseString);

                foreach (var item in items)
                {
                    item.Image = item.ImageURL;
                    FeedItems.Add(item);
                }
            }
            catch (Exception e)
            {
            }



            IsBusy = false;
        }
        private async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try{
                var httpClient     = new HttpClient();
                var feed           = "http://feeds.hanselman.com/ScottHanselman";
                var responseString = await httpClient.GetStringAsync(feed);

                FeedItems.Clear();
                var items = await ParseFeed(responseString);

                foreach (var item in items)
                {
                    FeedItems.Add(item);
                }
            } catch (Exception ex) {
                var page   = new ContentPage();
                var result = page.DisplayAlert("Error", "Unable to load blog.", "OK", null);
            }

            IsBusy = false;
        }
示例#3
0
        private async Task ExecuteLoadFilteredItemsCommand(string filter)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                FeedItems.Clear();

                var items = await _feedRepository.GetFilteredFeed(StaticData.RssFeed, filter);

                foreach (var item in items)
                {
                    FeedItems.Add(item);
                }
            }
            catch (Exception ex)
            {
                var page   = new ContentPage();
                var result = page.DisplayAlert("Error", "Unable to load filtered podcast feed. " + ex.Message, "OK");

                Insights.Report(ex, new Dictionary <string, string> {
                    { "Error", "Unable to load filtered podcast feed." },
                    { "Message", ex.Message },
                    { "Result", result.ToString() }
                });
            }

            IsBusy = false;
        }
        public async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            var httpClient     = new HttpClient();
            var feed           = "http://planet.xamarin.com/feed/";
            var responseString = await httpClient.GetStringAsync(feed);

            FeedItems.Clear();
            var items = await ParseFeed(responseString);

            foreach (var item in items)
            {
                item.Image = Gravatar.GetUrl(item.Author);
                FeedItems.Add(item);
            }


            IsBusy = false;
        }
        private async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            var error = false;

            try
            {
                var httpClient = new HttpClient();
                var feed       = string.Empty;

                switch (item.MenuType)
                {
                case MenuType.Hanselminutes:
                    feed = "http://feeds.podtrac.com/9dPm65vdpLL1";
                    break;

                case MenuType.Ratchet:
                    feed = "http://feeds.feedburner.com/RatchetAndTheGeek?format=xml";
                    break;

                case MenuType.DeveloperLife:
                    feed = "http://feeds.feedburner.com/ThisDevelopersLife?format=xml";
                    break;
                }
                var responseString = await httpClient.GetStringAsync(feed);

                FeedItems.Clear();
                var items = await ParseFeed(responseString);

                foreach (var feedItem in items)
                {
                    FeedItems.Add(feedItem);
                }
            }
            catch
            {
                error = true;
            }

            if (error)
            {
                var page   = new ContentPage();
                var result = page.DisplayAlert("Error", "Unable to load podcast feed.", "OK");
            }


            IsBusy = false;
        }
        public async void ReloadItemsAsync()
        {
            BusyCount++;
            FeedItems.HasMoreItems = false;
            FeedItems.Clear();
            //FeedItems.CanMoreItems();

            await FeedItems.LoadMoreItemsAsync(0);

            FeedItems.HasMoreItems = FeedItems.Count > 0;
            BusyCount--;
        }
        private async Task ExecuteLoadItemsCommandAsync()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            bool error = false;

            try
            {
                HttpClient httpClient = new HttpClient();
                string     feed       = string.Empty;
                switch (item)
                {
                case MenuType.Playlist:
                    feed = @"https://software-enginnering-daily-api.herokuapp.com/api/posts";
                    break;

                case MenuType.Podcast:
                    feed = @"https://software-enginnering-daily-api.herokuapp.com/api/posts";
                    break;

                case MenuType.Twitter:
                    feed = @"https://feeds.podtrac.com/9dPm65vdpLL1";
                    break;
                }

                string responseString = await httpClient.GetStringAsync(feed);

                FeedItems.Clear();
                var items = await ParseFeed(responseString);

                foreach (var feedItem in items)
                {
                    FeedItems.Add(feedItem);
                }
            }
            catch (Exception e)
            {
                error = true;
                Debug.WriteLine(e.Message);
            }

            if (error)
            {
                ContentPage page   = new ContentPage();
                Task        result = page.DisplayAlert("Error", $"Unable to load podcast feed.", "OK");
            }

            IsBusy = false;
        }
示例#8
0
        private async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy    = true;
            IsNotBusy = false;

            try
            {
                FeedItems.Clear();

                var items = await _feedRepository.GetAll(StaticData.RssFeed);

                foreach (var item in items)
                {
                    FeedItems.Add(item);
                }

                LastFeedItem = FeedItems[0];

                PodcastTitle = LastFeedItem.Title;
                PodcastDate  = LastFeedItem.PublishDate;

                if (LastFeedItem.FileImage != null)
                {
                    FileImage = LastFeedItem.FileImage;
                }
                else
                {
                    FileImage = "empty_image.png";
                }
            }
            catch (Exception ex)
            {
                var page   = new ContentPage();
                var result = page.DisplayAlert("Error", "Unable to load podcast feed. " + ex.Message, "OK");

                Insights.Report(ex, new Dictionary <string, string> {
                    { "Error", "Unable to load podcast feed." },
                    { "Message", ex.Message },
                    { "Result", result.ToString() }
                });
            }

            IsBusy    = false;
            IsNotBusy = true;
        }
示例#9
0
        /// <summary>
        /// RSSフィード取得コマンドを実行する
        /// </summary>
        private void GetRssExecute()
        {
            // RSSフィード取得中のフラグをオンにします。
            IsProgress = true;

            if (FeedItems != null)
            {
                // 現在のフィード情報をクリアする
                FeedItems.Clear();
            }

            // RSSフィードを非同期で取得します。
            Task result = GetRSSAsync(FeedUrl);
        }
示例#10
0
        /// <summary>
        /// The GetFeed
        /// </summary>
        /// <param name="refresh">The <see cref="bool"/></param>
        private void GetFeed(bool refresh)
        {
            IsProcessing = true;
            FeedItems.Clear();

            LoadFeedFromStore();

            //if refresh is on, get feed from web
            if (refresh && FeedUrl != null)
            {
                LoadFeedFromWeb();
            }
            if (timer != null)
            {
                timer.Change(this.ReloadInterval * 1000, this.ReloadInterval * 1000);
            }
            IsProcessing = false;
        }
        private void LoadAction()
        {
            FeedItems?.Clear();
            SelectedFeedItem = null;

            using (XmlReader reader = XmlReader.Create(FeedURL))
            {
                SyndicationFeed feed = SyndicationFeed.Load(reader);

                //Next step, getting Images from Comic feeds/etc.
                foreach (SyndicationItem item in feed.Items)
                {
                    FeedItems.Add(FeedItemModel.FromSyndicationItem(item));
                }
            }

            OnPropertyChanged(nameof(FeedItems));
        }
示例#12
0
        private async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            var error = false;

            try
            {
                var responseString = string.Empty;
                //TODO: get feed and
                //using (var httpClient = new HttpClient())
                //{
                //	var feed = "http://feeds.hanselman.com/ScottHanselman";
                //	responseString = await httpClient.GetStringAsync(feed);
                //}

                FeedItems.Clear();
                var items = await ParseFeed(responseString);

                foreach (var item in items)
                {
                    FeedItems.Add(item);
                }
            }
            catch
            {
                error = true;
            }

            if (error)
            {
                var page = new ContentPage();
                await page.DisplayAlert("Error", "Unable to load blog.", "OK");
            }

            IsBusy = false;
        }
        private async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            var error = false;

            try
            {
                var responseString = string.Empty;
                using (var httpClient = new HttpClient())
                {
                    var feed = "http://lawebdelprogramador.cl/bloglawebdelprogramador/feed/";
                    responseString = await httpClient.GetStringAsync(feed);
                }

                FeedItems.Clear();
                var items = await ParseFeed(responseString);

                foreach (var item in items)
                {
                    FeedItems.Add(item);
                }
            }
            catch
            {
                error = true;
            }

            if (error)
            {
                var page = new ContentPage();
                await page.DisplayAlert("Error", "No es posible cargar el blog en este momento", "OK");
            }

            IsBusy = false;
        }
示例#14
0
        private async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            var error = false;

            try
            {
                var responseString = string.Empty;
                using (var httpClient = new HttpClient())
                {
                    var feed = "https://bwired.ca/blog/feed";
                    responseString = await httpClient.GetStringAsync(feed);
                }

                FeedItems.Clear();
                var items = await ParseFeed(responseString);

                foreach (var item in items)
                {
                    FeedItems.Add(item);
                }
            }
            catch
            {
                error = true;
            }

            if (error)
            {
                var page = new ContentPage();
                await page.DisplayAlert("Error", "Unable to load blog.", "OK");
            }

            IsBusy = false;
        }
示例#15
0
 public async void ReloadItemsAsync()
 {
     FeedItems.Clear();
     FeedItems.CanMoreItems();
     await FeedItems.LoadMoreItemsAsync(0);
 }