2023-05-24 19:27:22 +02:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2023-05-23 15:04:02 +02:00
|
|
|
using MudBlazor;
|
2023-05-15 15:53:08 +02:00
|
|
|
using SharpRss.Models;
|
2023-05-23 15:04:02 +02:00
|
|
|
using ToolQit;
|
2023-05-15 15:53:08 +02:00
|
|
|
|
|
|
|
namespace WebSharpRSS.Models
|
|
|
|
{
|
2023-05-15 20:42:42 +02:00
|
|
|
public class TreeItemData
|
2023-05-15 15:53:08 +02:00
|
|
|
{
|
2023-06-01 15:55:15 +02:00
|
|
|
public TreeItemData(CategoryModel groupModel)
|
2023-05-15 15:53:08 +02:00
|
|
|
{
|
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-15 15:53:08 +02:00
|
|
|
|
2023-05-23 15:04:02 +02:00
|
|
|
public TreeItemData(FeedModel feedModel)
|
2023-05-15 15:53:08 +02:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
2023-06-01 15:55:15 +02:00
|
|
|
public readonly CategoryModel? GroupModel;
|
2023-05-15 15:53:08 +02:00
|
|
|
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; }
|
2023-05-15 15:53:08 +02:00
|
|
|
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; }
|
2023-05-15 15:53:08 +02:00
|
|
|
public bool IsExpanded { get; set; }
|
|
|
|
}
|
|
|
|
}
|