重构项目,将项目拆分(临时提交)

This commit is contained in:
2025-07-18 22:21:16 +08:00
parent 2cde703f1a
commit 7ca6e4e127
189 changed files with 1090 additions and 1667 deletions

View File

@@ -0,0 +1,36 @@
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace DMS.ValueConverts;
public class EnumDescriptionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return DependencyProperty.UnsetValue;
return GetEnumDescription(value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.Empty;
}
private string GetEnumDescription(object enumObj)
{
if (enumObj == null) return null; // AddAsync null check here
var fi = enumObj.GetType().GetField(enumObj.ToString());
var attributes =
(DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
if (attributes != null && attributes.Length > 0)
return attributes[0].Description;
return enumObj.ToString();
}
}