Files
ersatztv/ErsatzTV/Shared/AddCustomResolutionDialog.razor
T
Jason DoveandGitHub 245c4ec359 code analysis and cleanup (#1411)
* cleanup scanner project

* cleanup infrastructure projects

* cleanup ffmpeg project

* cleanup core project

* cleanup app project

* cleanup main project

* update dependencies

* code cleanup
2023-09-03 06:23:42 -05:00

44 lines
1.3 KiB
Plaintext

<MudDialog>
<DialogContent>
<EditForm Model="@_model" OnSubmit="@(_ => Submit())">
<MudElement HtmlTag="div" Class="mt-3">
<MudTextField Label="Width" @bind-Value="@_model.Width" For="@(() => _model.Width)" Style="min-width: 400px"/>
</MudElement>
<MudElement HtmlTag="div" Class="mt-3">
<MudTextField Label="Height" @bind-Value="@_model.Height" For="@(() => _model.Height)" Style="min-width: 400px"/>
</MudElement>
</EditForm>
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel" ButtonType="ButtonType.Reset">Cancel</MudButton>
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="Submit">
Add
</MudButton>
</DialogActions>
</MudDialog>
@code {
[CascadingParameter]
MudDialogInstance MudDialog { get; set; }
private readonly ResolutionEditViewModel _model = new();
private void Submit() =>
MudDialog.Close(DialogResult.Ok(_model));
private void Cancel(MouseEventArgs e)
{
// this is gross, but [enter] seems to sometimes trigger cancel instead of submit
if (e.Detail == 0)
{
Submit();
}
else
{
MudDialog.Cancel();
}
}
}