Skip to content

Commit

Permalink
bugfix - hotkey output erase
Browse files Browse the repository at this point in the history
  • Loading branch information
MSeys committed Nov 14, 2023
1 parent e4a4f78 commit ba7d059
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions HandheldCompanion/Managers/Hotkeys/Hotkey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,21 +347,25 @@ public void DrawInput()

private void DrawOutput()
{
// update button content
switch (HasOutput())
// UI thread (async)
Application.Current.Dispatcher.BeginInvoke(() =>
{
case true:
mainControl.HotkeyOutput.Content =
string.Join(", ", inputsChord.OutputKeys.Where(key => key.IsKeyDown));
mainControl.HotkeyOutput.SetResourceReference(Control.ForegroundProperty,
"SystemControlForegroundBaseHighBrush");
break;
case false:
mainControl.HotkeyOutput.Content = Resources.ResourceManager.GetString("InputsHotkey_fallbackOutput");
mainControl.HotkeyOutput.SetResourceReference(Control.ForegroundProperty,
"SystemControlForegroundBaseMediumBrush");
break;
}
// update button content
switch (HasOutput())
{
case true:
mainControl.HotkeyOutput.Content =
string.Join(", ", inputsChord.OutputKeys.Where(key => key.IsKeyDown));
mainControl.HotkeyOutput.SetResourceReference(Control.ForegroundProperty,
"SystemControlForegroundBaseHighBrush");
break;
case false:
mainControl.HotkeyOutput.Content = Resources.ResourceManager.GetString("InputsHotkey_fallbackOutput");
mainControl.HotkeyOutput.SetResourceReference(Control.ForegroundProperty,
"SystemControlForegroundBaseMediumBrush");
break;
}
});

DrawErase();
}
Expand Down

0 comments on commit ba7d059

Please sign in to comment.