返回提交历史
Modified
XFEWorkflow/XFEWorkflow/ViewModels/MainPageViewModel.cs
+4
-2
XFEstudio/XFEWorkflow
为鼠标与键盘操作使用对应设备图标
b133261
代码差异
1 个文件
+4
-2
@@ -15,7 +15,7 @@ public sealed class PaletteItem(CapabilityDescriptor descriptor, string pluginNa
15
15
public string FavoriteGlyph => IsFavorite ? "\uE735" : "\uE734";
16
16
public CapabilityDescriptor Descriptor { get; } = descriptor;
17
17
public string Name => Descriptor.Name;
18
public string Category => Descriptor.Category;
18
public string Category => Descriptor.Id is "xfe.desktop.text" or "xfe.desktop.keys" ? "键盘操作" : Descriptor.Category;
19
19
public string PluginName { get; } = pluginName;
20
20
public string SourceLabel => Descriptor.PluginId == "core" ? "内置节点" : "插件 · " + PluginName;
21
21
public string Description => string.IsNullOrWhiteSpace(Descriptor.Description) ? Name + " · " + SourceLabel : Descriptor.Description;
@@ -23,6 +23,8 @@ public sealed class PaletteItem(CapabilityDescriptor descriptor, string pluginNa
23
23
public int SortOrder => Descriptor.Id switch { "core.start" => 0, "core.end" => 1, _ => 2 };
24
24
public string Glyph => ((char)(Descriptor.Id switch
25
25
{
26
_ when Category == "鼠标操作" || Descriptor.Id is "xfe.desktop.click" or "xfe.vision.clickText" or "xfe.vision.clickImage" => (Symbol)0xE962,
27
_ when Category == "键盘操作" || Descriptor.Id == "xfe.desktop.fill" => (Symbol)0xE765,
26
28
"core.start" => Symbol.Play, "core.end" => Symbol.Stop, "core.delay" => Symbol.Clock,
27
29
"core.csharp" => Symbol.Edit, "core.log" => Symbol.Document, "core.set" => Symbol.Library,
28
30
"core.foreach" or "core.while" => Symbol.Sync, "core.if" or "core.switch" or "core.parallel" => Symbol.Shuffle,
@@ -48,7 +50,7 @@ public sealed class PaletteGroup(string name, IEnumerable<PaletteItem> items) :
48
50
private bool expanded;
49
51
public bool IsExpanded { get => expanded; set { expanded = value; OnPropertyChanged(new(nameof(Chevron))); } }
50
52
public string Chevron => IsExpanded ? "\uE70D" : "\uE76C";
51
public string Glyph => this.FirstOrDefault()?.Glyph ?? "\uE8A9";
53
public string Glyph => Name switch { "鼠标操作" => "\uE962", "键盘操作" => "\uE765", _ => this.FirstOrDefault()?.Glyph ?? "\uE8A9" };
52
54
}
53
55
public enum PaletteMode { All, Favorites, Recent }
54
56
public sealed record PaletteSourceOption(string Id, string Name);