@page "/" @using CodeHollow.FeedReader; @using SharpRss.Models; @using WebSharpRSS.Models; @using SharpRss.Services @inject FeedStateContainer _stateContainer; @*@foreach (var feedItemData in _itemDatas) { @if (feedItemData.Icon != null) { } @if (feedItemData.FaviconUrl != null) { } @feedItemData.FeedItem.Title @feedItemData.FeedItem.Description @feedItemData.FeedItem.PublishingDate.ToString() }*@ @code { protected override void OnInitialized() { UpdateFeeds(); //_stateContainer.StateChanged += FeedsChanged; } private void FeedsChanged() { UpdateFeeds(); InvokeAsync(StateHasChanged); } //private HashSet _itemDatas = new HashSet(); //private TreeItemData? _treeItemData; private void UpdateFeeds() { /*if (_stateContainer.TreeItem == null) return; _treeItemData = _stateContainer.TreeItem; if (_treeItemData.Feed != null) { Feed feed = _treeItemData.Feed; _itemDatas = feed.Items.Select(x => new FeedItemData(x) { Icon = _treeItemData.Icon, FaviconUrl = _treeItemData.FaviconUrl, CategoryColorHex = _treeItemData.CategoryModel?.HexColor }).ToHashSet(); } else if (_treeItemData.Feeds != null) { HashSet items = new HashSet(); foreach (var treeItem in _treeItemData.Feeds) { if (treeItem.Feed == null) continue; items.UnionWith(treeItem.Feed.Items.Select(x => new FeedItemData(x) { Icon = treeItem.Icon, FaviconUrl = treeItem.FaviconUrl, CategoryColorHex = _treeItemData.CategoryModel?.HexColor })); _itemDatas = items.OrderBy(x => x.FeedItem.PublishingDate).Reverse().ToHashSet(); } }*/ } }