Skip to content

Commit

Permalink
improve hotkey type visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkirie committed Oct 9, 2022
1 parent 27c2d1c commit 460fe22
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions HandheldCompanion/Managers/Classes/Hotkey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,27 @@ public Button GetDeleteButton()

public void UpdateButtons()
{
string content = string.Empty;
SimpleStackPanel content = new() { Orientation = Orientation.Horizontal, Spacing = 6 };

bool haskey = !string.IsNullOrEmpty(inputsChord.key);
bool hasbuttons = (inputsChord.buttons != SharpDX.XInput.GamepadButtonFlags.None);

string buttons = EnumUtils.GetDescriptionFromEnumValue(inputsChord.buttons);

if (haskey && hasbuttons)
content = string.Join(" + ", inputsChord.key, buttons);
content.Children.Add(new TextBlock() { Text = string.Join(" + ", inputsChord.key, buttons) });
else if (haskey)
content = inputsChord.key;
content.Children.Add(new TextBlock() { Text = inputsChord.key });
else if (hasbuttons)
content = buttons;
content.Children.Add(new TextBlock() { Text = buttons });

if (!string.IsNullOrEmpty(content))
content = string.Join(" ", content, inputsChord.type);
if (content.Children.Count > 0)
{
TextBlock type = new TextBlock() { Text = inputsChord.type.ToString() };
type.SetResourceReference(Control.ForegroundProperty, "AccentButtonBackground");

content.Children.Add(type);
}

mainButton.Content = content;

Expand Down

0 comments on commit 460fe22

Please sign in to comment.