mirror of
https://github.com/hmaxnl/SharpRSS.git
synced 2024-09-20 01:54:20 +02:00
43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using MudBlazor;
|
|
using SharpRss;
|
|
using SharpRss.Models;
|
|
using ToolQit;
|
|
|
|
namespace WebSharpRSS.Models
|
|
{
|
|
public class TreeItemData
|
|
{
|
|
public TreeItemData(CategoryModel categoryModel)
|
|
{
|
|
CategoryModel = categoryModel;
|
|
Title = categoryModel.Name;
|
|
Icon = categoryModel.Icon == string.Empty ? Icons.Material.Filled.RssFeed : categoryModel.Icon;
|
|
HasChildren = CategoryModel.SyndicationCount > 0;
|
|
}
|
|
|
|
public TreeItemData(SyndicationModel syndicationModel)
|
|
{
|
|
SyndicationModel = syndicationModel;
|
|
Title = syndicationModel.Title ?? string.Empty;
|
|
if (SyndicationModel.EncodedUrl == null) return;
|
|
FaviconUrl = string.Format(Caretaker.Settings["Paths"].GetString("FaviconResolveUrl"), new Uri(SyndicationManager.DecodeUrlFromBase64(SyndicationModel.EncodedUrl)).Host);
|
|
TotalItems = SyndicationModel.ItemCount;
|
|
}
|
|
public readonly CategoryModel? CategoryModel;
|
|
public readonly SyndicationModel? SyndicationModel;
|
|
|
|
public HashSet<TreeItemData>? Children { get; set; }
|
|
public string Title { get; set; }
|
|
public bool IsSelected { get; set; }
|
|
public string? Icon { get; set; }
|
|
public string? FaviconUrl { get; set; }
|
|
public bool HasChildren { get; set; }
|
|
public bool Loading { get; set; }
|
|
public bool IsExpanded { get; set; }
|
|
public int TotalItems { get; set; }
|
|
}
|
|
} |