private ObservableCollection<Models.NewsFeedEntryModel> getEntries(Models.NewsFeedsModel feed)
        {
            var feedUrl = feed.URL;

            using (var feedReader = XmlReader.Create(feedUrl))
            {
                try
                {
                    var feedContent = SyndicationFeed.Load(feedReader);

                    if (null == feedContent) return new EasySocial.FrameWork.Collections.AsyncObservableCollection<Models.NewsFeedEntryModel>(); ;

                    IEnumerable<Models.NewsFeedEntryModel> entries = feedContent.Items.Select(x => new Models.NewsFeedEntryModel()
                    {
                        Date = x.PublishDate.Date,
                        Message = x.Summary.Text,
                        Url = x.Links[0].Uri.ToString(),
                        Title = x.Title.Text
                    });

                    EasySocial.FrameWork.Collections.AsyncObservableCollection<Models.NewsFeedEntryModel> retEntries = new EasySocial.FrameWork.Collections.AsyncObservableCollection<Models.NewsFeedEntryModel>();

                    foreach (Models.NewsFeedEntryModel entry in entries) retEntries.Add(entry);
                    return retEntries;
                }
                catch
                {
                    return new EasySocial.FrameWork.Collections.AsyncObservableCollection<Models.NewsFeedEntryModel>(); ;
                }
            }
        }
Esempio n. 2
0
 public Weather(EasySocial.FrameWork.Intelligence.BaseIntelligence intelligence)
     : base(intelligence)
 {
     _view = new PlgWeather.Views.WeatherView();
     ((PlgWeather.ViewModels.WeatherViewModel)_view.DataContext).BaseIntelligence = intelligence;
     PageTitle = "Weather";
     MenuItems = new EasySocial.FrameWork.Collections.AsyncObservableCollection<EasySocial.FrameWork.Models.SubMenuItem>();
     NotifyPropertyChanged("MenuItems");
 }
        private void GetFeeds()
        {
            EasySocial.FrameWork.Collections.AsyncObservableCollection<Models.NewsFeedsModel> resultingfeeds = new EasySocial.FrameWork.Collections.AsyncObservableCollection<Models.NewsFeedsModel>();
            System.Data.Linq.Table<TableModels.NewsFeedTable> table = (System.Data.Linq.Table<TableModels.NewsFeedTable>)CoreIntelligence.RepositoryIntelligence.LoadTable(typeof(TableModels.NewsFeedTable));
            IEnumerable<TableModels.NewsFeedTable> feeds = table.OrderBy(x => x.Name);
            foreach (TableModels.NewsFeedTable feed in feeds)
            {
                Models.NewsFeedsModel resultingfeed = new Models.NewsFeedsModel();
                resultingfeed.Name = feed.Name;
                resultingfeed.URL = feed.URL;

                resultingfeeds.Add(resultingfeed);
            }

            Feeds = resultingfeeds;
            NotifyPropertyChanged("Feeds");
        }
Esempio n. 4
0
        public override void Load()
        {
            _view = new PlgMessaging.Views.MessagingView();
            _view.DataContext = new PlgMessaging.ViewModels.MessagingViewModel()
            {
                BaseIntelligence = Intelligence
            };

            MenuItems = new EasySocial.FrameWork.Collections.AsyncObservableCollection<EasySocial.FrameWork.Models.SubMenuItem>()
            {
                new EasySocial.FrameWork.Models.SubMenuItem()
                {
                    Title = "Contacts",
                    OpenCommand = (EasySocial.FrameWork.Commands.BaseCommand)((PlgMessaging.ViewModels.MessagingViewModel)_view.DataContext).ChangePageCommand,
                    CommandParam = "Contacts",
                },
                new EasySocial.FrameWork.Models.SubMenuItem()
                {
                    Title = "Chats",
                    OpenCommand = (EasySocial.FrameWork.Commands.BaseCommand)((PlgMessaging.ViewModels.MessagingViewModel)_view.DataContext).ChangePageCommand,
                    CommandParam = "Chats"
                },
                new EasySocial.FrameWork.Models.SubMenuItem()
                {
                    Title = "Calls",
                    OpenCommand = (EasySocial.FrameWork.Commands.BaseCommand)((PlgMessaging.ViewModels.MessagingViewModel)_view.DataContext).ChangePageCommand,
                    CommandParam = "Calls"
                },
                new EasySocial.FrameWork.Models.SubMenuItem()
                {
                    Title = "History",
                    OpenCommand = (EasySocial.FrameWork.Commands.BaseCommand)((PlgMessaging.ViewModels.MessagingViewModel)_view.DataContext).ChangePageCommand,
                    CommandParam = "History"
                },
                new EasySocial.FrameWork.Models.SubMenuItem()
                {
                    Title = "IM Accounts",
                    OpenCommand = (EasySocial.FrameWork.Commands.BaseCommand)((PlgMessaging.ViewModels.MessagingViewModel)_view.DataContext).ChangePageCommand,
                    CommandParam = "Accounts"
                }

            };
        }
Esempio n. 5
0
        private void refreshItemsFunc(object feedUrl)
        {
            ObservableCollection<NewsFeedEntryModel> entries = new EasySocial.FrameWork.Collections.AsyncObservableCollection<NewsFeedEntryModel>();

            Sloppycode.net.RssReader reader = new Sloppycode.net.RssReader();
            //reader.RdfMode = true;

            Sloppycode.net.RssFeed feed = reader.Retrieve((String)feedUrl);

            foreach (Sloppycode.net.RssItem item in feed.Items)
            {
                NewsFeedEntryModel entry = new NewsFeedEntryModel();
                entry.Title = item.Title;
                try
                {
                    entry.Date = DateTime.Parse(item.Pubdate);
                }
                catch
                {
                    entry.Date = DateTime.Now;
                }
                entry.Url = item.Link;
                entries.Add(entry);
            }
            if (entries.Count() != _entries.Count())
            {
                _entries = entries;
                NotifyPropertyChanged("Entries");
            }
            else
            {
                if (!entries.SequenceEqual(_entries, new PlgNewsFeeds.Comparer.NewsFeedEntryComparer()))
                {
                    _entries = entries;
                    NotifyPropertyChanged("Entries");
                }
            }
        }