Skip to content

Commit

Permalink
Update RecordControl.razor
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed Jul 5, 2024
1 parent fab9142 commit 2680da6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions AudioCuesheetEditor/Pages/RecordControl.razor
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ along with Foobar. If not, see
@inject ITextLocalizer<RecordControl> _localizer
@inject ITextLocalizerService _localizationService
@inject LocalStorageOptionsProvider _localStorageOptionsProvider
@inject HotKeys _hotKeys

@if (_sessionStateContainer.Cuesheet.IsRecording == true)
{
Expand Down Expand Up @@ -74,7 +75,7 @@ along with Foobar. If not, see

<ModalDialog @ref="modalDialog" />

<Modal @ref="modalInputCountdownTime">
<Modal @ref="modalInputCountdownTime" VisibleChanged="(visible) => modalInputCountdownTimeVisible = visible">
<ModalContent Centered>
<ModalHeader>
<ModalTitle>@_localizer["Start record countdown timer"]</ModalTitle>
Expand Down Expand Up @@ -103,16 +104,17 @@ along with Foobar. If not, see

@code {
//TODO: Allow the user to stop the record countdown
//TODO: Keyboard enter for modal
Timer updateGUITimer = new Timer(300);
Timer? startRecordTimer;
DateTime recordTimerStarted;
HotKeysContext? hotKeysContext;

RecordOptions? recordOptions;
uint recordCountdownTimer;

ModalDialog? modalDialog;
Modal? modalInputCountdownTime;
Boolean modalInputCountdownTimeVisible = false;

[Parameter]
public EventCallback StartRecordClicked { get; set; }
Expand All @@ -122,6 +124,7 @@ along with Foobar. If not, see

public void Dispose()
{
hotKeysContext?.Dispose();
_localizationService.LocalizationChanged -= LocalizationService_LocalizationChanged;
_sessionStateContainer.CuesheetChanged -= SessionStateContainer_CuesheetChanged;
_localStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionsSaved;
Expand All @@ -131,6 +134,9 @@ along with Foobar. If not, see
{
await base.OnInitializedAsync();

hotKeysContext = _hotKeys.CreateContext()
.Add(Key.Enter, OnEnterKeyDown);

recordOptions = await _localStorageOptionsProvider.GetOptions<RecordOptions>();
ReadOutOptions();

Expand Down Expand Up @@ -262,4 +268,12 @@ along with Foobar. If not, see
recordCountdownTimer = recordOptions.RecordCountdownTimer;
}
}

async ValueTask OnEnterKeyDown()
{
if (modalInputCountdownTimeVisible)
{
await StartRecordCountdownTimer();
}
}
}

0 comments on commit 2680da6

Please sign in to comment.