Skip to content

Commit

Permalink
Fix kbd capture OnLoad for favorites and cmd palette (#1374)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencohn authored Apr 29, 2024
1 parent 30365fb commit 07d0c01
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
2 changes: 2 additions & 0 deletions OneMore/Commands/Favorites/FavoritesDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public FavoritesDialog()

private async void BindOnLoad(object sender, EventArgs e)
{
Native.SwitchToThisWindow(Handle, false);

await using var provider = new FavoritesProvider(null);
var favorites = provider.LoadFavorites();

Expand Down
8 changes: 7 additions & 1 deletion OneMore/Commands/Tools/CommandPaletteDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace River.OneMoreAddIn.Commands
{
using NStandard;
using River.OneMoreAddIn.UI;
using System;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -52,6 +51,13 @@ public CommandPaletteDialog()
public bool Recent { get; private set; }


protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Native.SwitchToThisWindow(Handle, false);
}


public void PopulateCommands(string[] commands, string[] recentNames)
{
palette.LoadCommands(commands, recentNames);
Expand Down
29 changes: 29 additions & 0 deletions OneMore/Helpers/Extensions/ArrayExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//************************************************************************************************
// Copyright © 2024 Steven M Cohn. All rights reserved.
//************************************************************************************************

namespace River.OneMoreAddIn
{
using System;


internal static class ArrayExtensions
{

public static int IndexOf<T>(this T[] array, Func<T, bool> predicate)
{
int num = 0;
foreach (T arg in array)
{
if (predicate(arg))
{
return num;
}

num++;
}

return -1;
}
}
}
1 change: 1 addition & 0 deletions OneMore/OneMore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
</Compile>
<Compile Include="Commands\Tagging\TagBankCommand.cs" />
<Compile Include="Helpers\ColorHelper.cs" />
<Compile Include="Helpers\Extensions\ArrayExtensions.cs" />
<Compile Include="Helpers\Extensions\FontFamilyExtensions.cs" />
<Compile Include="Helpers\Extensions\GraphicsExtensions.cs" />
<Compile Include="Helpers\Extensions\HashAlgorithmExtensions.cs" />
Expand Down

0 comments on commit 07d0c01

Please sign in to comment.