Skip to content

Commit 317f241

Browse files
committed
- Add Comment
- Applied changes from CodeRabbit
1 parent be0a9b7 commit 317f241

File tree

2 files changed

+94
-85
lines changed

2 files changed

+94
-85
lines changed

Flow.Launcher/Resources/Controls/InfoBar.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ private void InfoBar_Loaded(object sender, RoutedEventArgs e)
1919
UpdateMessageVisibility();
2020
UpdateOrientation();
2121
UpdateIconAlignmentAndMargin();
22+
UpdateIconVisibility();
23+
UpdateCloseButtonVisibility();
2224
}
2325

2426
public static readonly DependencyProperty TypeProperty =

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs

Lines changed: 92 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public SettingsPaneGeneralViewModel(Settings settings, Updater updater, IPortabl
3434
_portable = portable;
3535
_translater = translater;
3636
UpdateEnumDropdownLocalizations();
37+
// Initialize the Korean IME status by checking registry
3738
IsLegacyKoreanIMEEnabled();
3839
OpenImeSettingsCommand = new RelayCommand(OpenImeSettings);
3940
}
@@ -188,129 +189,135 @@ public string Language
188189
UpdateEnumDropdownLocalizations();
189190
}
190191
}
192+
193+
// The new Korean IME used in Windows 11 has compatibility issues with WPF. This issue is difficult to resolve within
194+
// WPF itself, but it can be avoided by having the user switch to the legacy IME at the system level. Therefore,
195+
// we provide guidance and a direct button for users to make this change themselves. If the relevant registry key does
196+
// not exist (i.e., the Korean IME is not installed), this setting will not be shown at all.
197+
#region Korean IME
191198
public bool LegacyKoreanIMEEnabled
192-
{
193-
get => IsLegacyKoreanIMEEnabled();
194-
set
195199
{
196-
Debug.WriteLine($"[DEBUG] LegacyKoreanIMEEnabled changed: {value}");
197-
if (SetLegacyKoreanIMEEnabled(value))
200+
get => IsLegacyKoreanIMEEnabled();
201+
set
198202
{
199-
OnPropertyChanged(nameof(LegacyKoreanIMEEnabled));
200-
OnPropertyChanged(nameof(KoreanIMERegistryValueIsZero));
203+
Debug.WriteLine($"[DEBUG] LegacyKoreanIMEEnabled changed: {value}");
204+
if (SetLegacyKoreanIMEEnabled(value))
205+
{
206+
OnPropertyChanged(nameof(LegacyKoreanIMEEnabled));
207+
OnPropertyChanged(nameof(KoreanIMERegistryValueIsZero));
208+
}
209+
else
210+
{
211+
Debug.WriteLine("[DEBUG] Failed to set LegacyKoreanIMEEnabled");
212+
}
201213
}
202-
else
214+
}
215+
216+
public bool KoreanIMERegistryKeyExists => IsKoreanIMEExist();
217+
218+
public bool KoreanIMERegistryValueIsZero
219+
{
220+
get
203221
{
204-
Debug.WriteLine("[DEBUG] Failed to set LegacyKoreanIMEEnabled");
222+
object value = GetLegacyKoreanIMERegistryValue();
223+
if (value is int intValue)
224+
{
225+
return intValue == 0;
226+
}
227+
else if (value != null && int.TryParse(value.ToString(), out int parsedValue))
228+
{
229+
return parsedValue == 0;
230+
}
231+
232+
return false;
205233
}
206234
}
207-
}
208235

209-
public bool KoreanIMERegistryKeyExists => IsKoreanIMEExist();
236+
bool IsKoreanIMEExist()
237+
{
238+
return GetLegacyKoreanIMERegistryValue() != null;
239+
}
210240

211-
public bool KoreanIMERegistryValueIsZero
212-
{
213-
get
241+
bool IsLegacyKoreanIMEEnabled()
214242
{
215243
object value = GetLegacyKoreanIMERegistryValue();
244+
216245
if (value is int intValue)
217246
{
218-
return intValue == 0;
247+
return intValue == 1;
219248
}
220249
else if (value != null && int.TryParse(value.ToString(), out int parsedValue))
221250
{
222-
return parsedValue == 0;
251+
return parsedValue == 1;
223252
}
224253

225254
return false;
226255
}
227-
}
228-
229-
bool IsKoreanIMEExist()
230-
{
231-
return GetLegacyKoreanIMERegistryValue() != null;
232-
}
233-
234-
bool IsLegacyKoreanIMEEnabled()
235-
{
236-
object value = GetLegacyKoreanIMERegistryValue();
237256

238-
if (value is int intValue)
239-
{
240-
return intValue == 1;
241-
}
242-
else if (value != null && int.TryParse(value.ToString(), out int parsedValue))
257+
bool SetLegacyKoreanIMEEnabled(bool enable)
243258
{
244-
return parsedValue == 1;
245-
}
259+
const string subKeyPath = @"Software\Microsoft\input\tsf\tsf3override\{A028AE76-01B1-46C2-99C4-ACD9858AE02F}";
260+
const string valueName = "NoTsf3Override5";
246261

247-
return false;
248-
}
249-
250-
bool SetLegacyKoreanIMEEnabled(bool enable)
251-
{
252-
const string subKeyPath = @"Software\Microsoft\input\tsf\tsf3override\{A028AE76-01B1-46C2-99C4-ACD9858AE02F}";
253-
const string valueName = "NoTsf3Override5";
254-
255-
try
256-
{
257-
using (RegistryKey key = Registry.CurrentUser.CreateSubKey(subKeyPath))
262+
try
258263
{
259-
if (key != null)
264+
using (RegistryKey key = Registry.CurrentUser.CreateSubKey(subKeyPath))
260265
{
261-
int value = enable ? 1 : 0;
262-
key.SetValue(valueName, value, RegistryValueKind.DWord);
263-
return true;
264-
}
265-
else
266-
{
267-
Debug.WriteLine($"[IME DEBUG] Failed to create or open registry key: {subKeyPath}");
266+
if (key != null)
267+
{
268+
int value = enable ? 1 : 0;
269+
key.SetValue(valueName, value, RegistryValueKind.DWord);
270+
return true;
271+
}
272+
else
273+
{
274+
Debug.WriteLine($"[IME DEBUG] Failed to create or open registry key: {subKeyPath}");
275+
}
268276
}
269277
}
270-
}
271-
catch (Exception ex)
272-
{
273-
Debug.WriteLine($"[IME DEBUG] Exception occurred while setting registry: {ex.Message}");
274-
}
275-
276-
return false;
277-
}
278+
catch (Exception ex)
279+
{
280+
Debug.WriteLine($"[IME DEBUG] Exception occurred while setting registry: {ex.Message}");
281+
}
278282

279-
private object GetLegacyKoreanIMERegistryValue()
280-
{
281-
const string subKeyPath = @"Software\Microsoft\input\tsf\tsf3override\{A028AE76-01B1-46C2-99C4-ACD9858AE02F}";
282-
const string valueName = "NoTsf3Override5";
283+
return false;
284+
}
283285

284-
try
286+
private object GetLegacyKoreanIMERegistryValue()
285287
{
286-
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(subKeyPath))
288+
const string subKeyPath = @"Software\Microsoft\input\tsf\tsf3override\{A028AE76-01B1-46C2-99C4-ACD9858AE02F}";
289+
const string valueName = "NoTsf3Override5";
290+
291+
try
287292
{
288-
if (key != null)
293+
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(subKeyPath))
289294
{
290-
return key.GetValue(valueName);
295+
if (key != null)
296+
{
297+
return key.GetValue(valueName);
298+
}
291299
}
292300
}
293-
}
294-
catch (Exception ex)
295-
{
296-
Debug.WriteLine($"[IME DEBUG] Exception occurred: {ex.Message}");
297-
}
298-
299-
return null;
300-
}
301+
catch (Exception ex)
302+
{
303+
Debug.WriteLine($"[IME DEBUG] Exception occurred: {ex.Message}");
304+
}
301305

302-
private void OpenImeSettings()
303-
{
304-
try
305-
{
306-
Process.Start(new ProcessStartInfo("ms-settings:regionlanguage") { UseShellExecute = true });
306+
return null;
307307
}
308-
catch (Exception e)
308+
309+
private void OpenImeSettings()
309310
{
310-
Debug.WriteLine($"Error opening IME settings: {e.Message}");
311+
try
312+
{
313+
Process.Start(new ProcessStartInfo("ms-settings:regionlanguage") { UseShellExecute = true });
314+
}
315+
catch (Exception e)
316+
{
317+
Debug.WriteLine($"Error opening IME settings: {e.Message}");
318+
}
311319
}
312-
}
313-
320+
#endregion
314321

315322
public bool ShouldUsePinyin
316323
{

0 commit comments

Comments
 (0)