-
Notifications
You must be signed in to change notification settings - Fork 813
Expand file tree
/
Copy pathSettingsPageButton.cs
More file actions
56 lines (50 loc) · 1.44 KB
/
SettingsPageButton.cs
File metadata and controls
56 lines (50 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Avalonia;
using UniGetUI.Avalonia.Views.Controls;
using UniGetUI.Interface.Enums;
namespace UniGetUI.Avalonia.Views.Controls.Settings;
public partial class SettingsPageButton : SettingsCard
{
public string Text
{
set => Header = value;
}
public string UnderText
{
set => Description = value;
}
public IconType Icon
{
set => HeaderIcon = new SvgIcon
{
Path = IconTypeToPath(value),
Width = 24,
Height = 24,
};
}
public SettingsPageButton()
{
CornerRadius = new CornerRadius(8);
IsClickEnabled = true;
}
private static string IconTypeToPath(IconType icon)
{
string name = icon switch
{
IconType.Chocolatey => "choco",
IconType.Package => "package",
IconType.UAC => "uac",
IconType.Update => "update",
IconType.Help => "help",
IconType.Console => "console",
IconType.Checksum => "checksum",
IconType.Download => "download",
IconType.Settings => "settings",
IconType.SaveAs => "save_as",
IconType.OpenFolder => "open_folder",
IconType.Experimental => "experimental",
IconType.ClipboardList => "clipboard_list",
_ => icon.ToString().ToLower(),
};
return $"avares://UniGetUI.Avalonia/Assets/Symbols/{name}.svg";
}
}