From 34a58bc5da51831b2b6cc2e3396d1f073569961e Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 5 Sep 2025 18:39:31 +0800 Subject: [PATCH] Add InverseBoolConverter --- .../Converters/InverseBoolConverter.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Plugins/Flow.Launcher.Plugin.Url/Converters/InverseBoolConverter.cs diff --git a/Plugins/Flow.Launcher.Plugin.Url/Converters/InverseBoolConverter.cs b/Plugins/Flow.Launcher.Plugin.Url/Converters/InverseBoolConverter.cs new file mode 100644 index 000000000..419bd070f --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.Url/Converters/InverseBoolConverter.cs @@ -0,0 +1,21 @@ +using System; +using System.Windows.Data; + +namespace Flow.Launcher.Plugin.Url.Converters; + +[ValueConversion(typeof(bool), typeof(bool))] +public class InverseBoolConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (targetType != typeof(bool)) + throw new InvalidOperationException("The target must be a boolean"); + + return !(bool)value; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotSupportedException(); + } +}