From 9d59933a08677717176ac9266f2122a5d986a2eb Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Tue, 20 Dec 2022 23:13:15 +0800
Subject: [PATCH] Add IME state
---
.../BoolToIMEConversionModeConverter.cs | 24 +++++++++++++++++++
Flow.Launcher/MainWindow.xaml | 2 ++
2 files changed, 26 insertions(+)
diff --git a/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs b/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs
index f3771e6d9..0bff23fe1 100644
--- a/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs
+++ b/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs
@@ -28,4 +28,28 @@ namespace Flow.Launcher.Converters
throw new NotImplementedException();
}
}
+
+ internal class BoolToIMEStateConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is bool v)
+ {
+ if (v)
+ {
+ return InputMethodState.Off;
+ }
+ else
+ {
+ return InputMethodState.DoNotCare;
+ }
+ }
+ return InputMethodState.DoNotCare;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
}
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index eca9fcdca..095382e76 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -39,6 +39,7 @@
+
@@ -207,6 +208,7 @@
Style="{DynamicResource QueryBoxStyle}"
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
InputMethod.PreferredImeConversionMode="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEConversionModeConverter}}"
+ InputMethod.PreferredImeState="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEStateConverter}}"
Visibility="Visible">