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.
32 lines
1.1 KiB
32 lines
1.1 KiB
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();
|
|
}
|
|
}
|
|
|