XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEToolBox

【WPF】XFE工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
using XFEToolBox.Client.Utilities;

namespace XFEToolBox.Client.Models;

public enum LauncherItemKind
{
    Page,
    Tool,
    Software,
    Project,
    Command
}

public sealed class PinnedItemEntry
{
    public LauncherItemKind Kind { get; set; }

    public string TargetId { get; set; } = string.Empty;

    public DateTimeOffset AddedAtUtc { get; set; }
}

public sealed class LauncherItem
{
    public required LauncherItemKind Kind { get; init; }

    public required string TargetId { get; init; }

    public required string Title { get; init; }

    public string Subtitle { get; init; } = string.Empty;

    public string Detail { get; init; } = string.Empty;

    public string[] Keywords { get; init; } = [];

    public string IconReference { get; init; } = string.Empty;

    public bool IsPinned { get; init; }

    public DateTimeOffset? LastUsedAtUtc { get; init; }

    public required Func<Task> ExecuteAsync { get; init; }

    public string Key => PinnedItemService.CreateKey(Kind, TargetId);

    public string KindText => Kind switch
    {
        LauncherItemKind.Page => "页面",
        LauncherItemKind.Tool => "工具",
        LauncherItemKind.Software => "软件",
        LauncherItemKind.Project => "项目",
        _ => "命令"
    };
}