Skip to content

Commit

Permalink
Merge pull request #804 from dremin/handle-kbd-layout-error
Browse files Browse the repository at this point in the history
Handle error getting keyboard layout
  • Loading branch information
dremin authored Apr 21, 2024
2 parents dbc09f2 + 4faf298 commit 145b988
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 10 additions & 2 deletions RetroBar/Controls/InputLanguage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Windows.Controls;
using System.Windows.Threading;
using ManagedShell.Common.Helpers;
using ManagedShell.Common.Logging;
using RetroBar.Utilities;

namespace RetroBar.Controls
Expand Down Expand Up @@ -47,8 +48,15 @@ private void Initialize()

private void SetLocaleIdentifier()
{
var managedShellLayout = KeyboardLayoutHelper.GetKeyboardLayout(false);
LocaleIdentifier = CultureInfo.GetCultureInfo((short)managedShellLayout.HKL);
try
{
var managedShellLayout = KeyboardLayoutHelper.GetKeyboardLayout(false);
LocaleIdentifier = CultureInfo.GetCultureInfo((short)managedShellLayout.HKL);
}
catch (Exception ex)
{
ShellLogger.Error($"Error getting locale identifier: {ex.Message}");
}
}

private void StartWatch()
Expand Down
2 changes: 0 additions & 2 deletions RetroBar/Utilities/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using ManagedShell.AppBar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;

namespace RetroBar.Utilities
Expand Down

0 comments on commit 145b988

Please sign in to comment.