Files
2026-08-27 11:22:54 -06:00

38 lines
801 B
C#

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace Crysome.Server.Converters;
public class BooleanToVisibilityConverter : IValueConverter
{
public bool Invert { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool flag = default(bool);
int num;
if (value is bool)
{
flag = (bool)value;
num = 1;
}
else
{
num = 0;
}
bool flag2 = (byte)((uint)num & (flag ? 1u : 0u)) != 0;
if (Invert)
{
flag2 = !flag2;
}
return (!flag2) ? Visibility.Collapsed : Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}