将Feature/XP.Common和Feature/XP.Hardware分支合并至Develop/XP.forHardwareAndCommon,完善XPapp注册和相关硬件类库通用类库功能。
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user