添加 MX-PD-盘古 项目文件

将 MX-PD-盘古 - new 目录下的所有文件添加到主仓库
This commit is contained in:
Shi.Ji
2026-05-18 11:43:09 +08:00
parent 03632a379d
commit e31d3560bb
739 changed files with 99783 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using System;
using System.Linq;
using System.Windows.Markup;
namespace MainShell.Converter
{
// XAML 中可直接写 {conv:EnumBindingSource {x:Type local:MyEnum}}
public class EnumBindingSourceExtension : MarkupExtension
{
public Type EnumType { get; set; }
public bool UseDescription { get; set; } = true;
public EnumBindingSourceExtension() { }
public EnumBindingSourceExtension(Type enumType)
{
EnumType = enumType;
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
if (EnumType == null || !EnumType.IsEnum) return null;
var values = Enum.GetValues(EnumType).Cast<Enum>();
return values.Select(v => new EnumItem
{
Value = v,
Description = UseDescription ? EnumHelper.GetEnumDescription(v) : v.ToString()
}).ToList();
}
}
public class EnumItem
{
public Enum Value { get; set; }
public string Description { get; set; }
public int IntValue => Convert.ToInt32(Value);
}
}