Multiprocotol Terminalprogram (BAT)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MultiTerm/MultiTerm.Wpf/ValueConverters/MessageImportanceToBrushCon...

32 lines
1.1 KiB

using Common.Messaging;
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace MultiTerm.Wpf.ValueConverters;
[ValueConversion(typeof(MessageImportance), typeof(Brush))]
internal class MessageImportanceToBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value is not MessageImportance msgImportance)
{ throw new ArgumentException($"Wrong object provided, can only convert from type {nameof(MessageImportance)}"); }
return msgImportance switch
{
MessageImportance.Normal => Brushes.Black,
MessageImportance.Medium => Brushes.DarkOrange,
MessageImportance.High => Brushes.Red,
MessageImportance.HighAndRequiresConfirmation => throw new NotImplementedException(),
_ => throw new NotImplementedException(),
};
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}