将Feature/XP.Common和Feature/XP.Hardware分支合并至Develop/XP.forHardwareAndCommon,完善XPapp注册和相关硬件类库通用类库功能。

This commit is contained in:
QI Mingxuan
2026-04-16 17:31:13 +08:00
parent 6ec4c3ddaa
commit 2bd6e566c3
581 changed files with 74600 additions and 222 deletions
@@ -0,0 +1,34 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using XP.Hardware.PLC.Sentry.Models;
namespace XP.Hardware.PLC.Sentry.Converters
{
/// <summary>
/// 日志级别到前景色转换器 | Log level to foreground color converter
/// </summary>
public class LogLevelToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is SentryLogLevel level)
{
return level switch
{
SentryLogLevel.Info => new SolidColorBrush(Color.FromRgb(0x33, 0x33, 0x33)),
SentryLogLevel.Warning => new SolidColorBrush(Color.FromRgb(0xFF, 0x8F, 0x00)),
SentryLogLevel.Error => new SolidColorBrush(Color.FromRgb(0xD3, 0x2F, 0x2F)),
_ => new SolidColorBrush(Color.FromRgb(0x33, 0x33, 0x33))
};
}
return new SolidColorBrush(Color.FromRgb(0x33, 0x33, 0x33));
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}