40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace Livia.Views.Converters;
|
|
|
|
[ValueConversion(typeof(int), typeof(Visibility))]
|
|
public class ServerJobStatusVisibilityCollapsedConverter : IValueConverter
|
|
{
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
return value switch
|
|
{
|
|
5 => Visibility.Visible,
|
|
_ => Visibility.Collapsed
|
|
};
|
|
}
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
}
|
|
[ValueConversion(typeof(int), typeof(Visibility))]
|
|
public class ServerJobStatusVisibilityHiddenConverter : IValueConverter
|
|
{
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
return value switch
|
|
{
|
|
5 => Visibility.Visible,
|
|
_ => Visibility.Hidden
|
|
};
|
|
}
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
} |