using Common.Messaging; using System; using System.Globalization; using System.Windows.Controls; 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.DarkSalmon, 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(); } }