Skip to content

Commit

Permalink
Added restriction for shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed Jul 1, 2024
1 parent e36e754 commit e0a77ad
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions AudioCuesheetEditor/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@ along with Foobar. If not, see
_traceChangeManager.UndoDone += TraceChangeManager_UndoDone;
_traceChangeManager.RedoDone += TraceChangeManager_RedoDone;
hotKeysContext = _hotKeys.CreateContext()
.Add(ModKey.Ctrl, Key.h, () => _navigationManager.NavigateTo("Help"))
.Add(ModKey.Ctrl, Key.e, OnStrgEKeyDown)
.Add(ModKey.Ctrl, Key.s, OnStrgSKeyDown)
.Add(ModKey.Ctrl, Key.h, OnCtrlHKeyDown)
.Add(ModKey.Ctrl, Key.e, OnCtrlEKeyDown)
.Add(ModKey.Ctrl, Key.s, OnCtrlSKeyDown)
.Add(Key.Enter, OnEnterKeyDown);

applicationOptions = await _localStorageOptionsProvider.GetOptions<ApplicationOptions>();
Expand Down Expand Up @@ -643,14 +643,26 @@ along with Foobar. If not, see
}
}

async ValueTask OnStrgEKeyDown()
ValueTask OnCtrlHKeyDown()
{
await OnDisplayExportProfilesClicked();
if (ShortCutsEnabled)
{
_navigationManager.NavigateTo("Help");
}
return ValueTask.CompletedTask;
}

async ValueTask OnStrgSKeyDown()
async ValueTask OnCtrlEKeyDown()
{
if (modalDownloadProjectfile != null)
if (ShortCutsEnabled)
{
await OnDisplayExportProfilesClicked();
}
}

async ValueTask OnCtrlSKeyDown()
{
if ((ShortCutsEnabled) && (modalDownloadProjectfile != null))
{
await modalDownloadProjectfile.Show();
}
Expand Down Expand Up @@ -885,4 +897,12 @@ along with Foobar. If not, see
}
return Task.CompletedTask;
}

Boolean ShortCutsEnabled
{
get
{
return !(_navigationManager.Uri.EndsWith("/help", StringComparison.InvariantCultureIgnoreCase)) && !(_navigationManager.Uri.EndsWith("/about", StringComparison.InvariantCultureIgnoreCase));
}
}
}

0 comments on commit e0a77ad

Please sign in to comment.