Rework emulator UI and add device creation wizard
This commit is contained in:
1 parent
c2084b6cd1
commit
9cf29c11ab
5 files changed
+1032
-180
No files matched your search
@@ -0,0 +1,37 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
internal sealed record DeviceCategory(string Label, string Value, params DeviceCategory[] Children);
|
||||
|
||||
internal static class DeviceCatalog
|
||||
{
|
||||
internal static readonly DeviceCategory[] Categories =
|
||||
[
|
||||
new DeviceCategory("全部", ""),
|
||||
new DeviceCategory("手机", "",
|
||||
new DeviceCategory("手机", "phone"), new DeviceCategory("折叠屏", "foldable"),
|
||||
new DeviceCategory("阔折叠", "widefold"), new DeviceCategory("三折叠", "triplefold")),
|
||||
new DeviceCategory("平板", "", new DeviceCategory("平板", "tablet")),
|
||||
new DeviceCategory("2in1", "", new DeviceCategory("2in1", "2in1"), new DeviceCategory("折叠2in1", "2in1 Foldable")),
|
||||
new DeviceCategory("电视", "", new DeviceCategory("电视", "tv")),
|
||||
new DeviceCategory("穿戴设备", "", new DeviceCategory("智能表", "wearable"), new DeviceCategory("儿童表", "wearablekid")),
|
||||
new DeviceCategory("车机", "", new DeviceCategory("车机", "car"))
|
||||
];
|
||||
|
||||
internal static readonly Dictionary<string, string> TypeNames = Categories
|
||||
.SelectMany(group => new[] { group }.Concat(group.Children))
|
||||
.Where(node => node.Value.Length > 0)
|
||||
.ToDictionary(node => node.Value, node => node.Label);
|
||||
|
||||
internal static TreeViewItem CreateItem(DeviceCategory node)
|
||||
{
|
||||
var item = new TreeViewItem
|
||||
{
|
||||
Header = node.Label,
|
||||
Tag = node,
|
||||
IsExpanded = node.Children.Length > 0
|
||||
};
|
||||
foreach (var child in node.Children)
|
||||
item.Items.Add(CreateItem(child));
|
||||
return item;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user