using Common.Messaging; using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace MultiTerm.Wpf.ValueConverters; [ValueConversion(typeof(MessageImportance), typeof(FontWeight))] internal class MessageImportanceToFontWeightConverter : 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 => FontWeights.Normal, MessageImportance.Medium => FontWeights.Medium, MessageImportance.High => FontWeights.Bold, MessageImportance.HighAndRequiresConfirmation => throw new NotImplementedException(), _ => throw new NotImplementedException(), }; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } }