SharpRSS/WebSharpRSS/Models/TreeItemData.cs

38 lines
1.2 KiB
C#
Raw Normal View History

2023-05-24 19:27:22 +02:00
using System;
using System.Collections.Generic;
2023-05-23 15:04:02 +02:00
using MudBlazor;
using SharpRss.Models;
2023-05-23 15:04:02 +02:00
using ToolQit;
namespace WebSharpRSS.Models
{
2023-05-15 20:42:42 +02:00
public class TreeItemData
{
public TreeItemData(CategoryModel groupModel)
{
2023-05-23 15:04:02 +02:00
GroupModel = groupModel;
Title = groupModel.Name;
Icon = groupModel.Icon == string.Empty ? Icons.Material.Filled.RssFeed : groupModel.Icon;
HasChild = groupModel.FeedCount > 0;
}
2023-05-23 15:04:02 +02:00
public TreeItemData(FeedModel feedModel)
{
FeedModel = feedModel;
2023-05-26 21:54:12 +02:00
Title = feedModel.Title ?? string.Empty;
if (FeedModel.Url == null) return;
FaviconUrl = string.Format(Caretaker.Settings["Paths"].GetString("FaviconResolveUrl"), new Uri(FeedModel.Url).Host);
2023-05-23 15:04:02 +02:00
}
public readonly CategoryModel? GroupModel;
public readonly FeedModel? FeedModel;
2023-05-23 15:04:02 +02:00
public HashSet<TreeItemData>? Children { get; set; }
2023-05-26 21:54:12 +02:00
public string Title { get; set; }
public bool IsSelected { get; set; }
public string? Icon { get; set; }
public string? FaviconUrl { get; set; }
2023-05-20 00:35:43 +02:00
public bool HasChild { get; set; }
2023-05-23 15:04:02 +02:00
public bool Loading { get; set; }
public bool IsExpanded { get; set; }
}
}