コード例 #1
0
        public NewsViewModel()
        {
            NewsSources = new ObservableCollection <NewsSource>();

            var category = new NewsSource("source one");

            category.AddNewsEntry(new NewsEntry("title one", "subtitle one qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", DateTimeOffset.Now));
            category.AddNewsEntry(new NewsEntry("title two", "subtitle two qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", DateTimeOffset.Now));
            NewsSources.Add(category);

            category = new NewsSource("source two");
            category.AddNewsEntry(new NewsEntry("title one", "subtitle one qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", DateTimeOffset.Now));
            category.AddNewsEntry(new NewsEntry("title two", "subtitle two qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", DateTimeOffset.Now));
            NewsSources.Add(category);
        }
コード例 #2
0
        public async Task UpdateAsync()
        {
            _NewsSources.Clear();

            foreach (var provider in _Providers)
            {
                var category = new NewsSource(provider.Name);
                foreach (var entry in await provider.GetNewsEntriesAsync())
                {
                    category.AddNewsEntry(entry);
                }
                _NewsSources.Add(category);
            }

            CategoriesUpdated?.Invoke(this, EventArgs.Empty);
        }