Update project name and namespaces

This commit is contained in:
ahjephson
2024-10-22 09:57:50 +01:00
parent e83488326b
commit 170b2ca601
226 changed files with 2776 additions and 848 deletions

View File

@@ -0,0 +1,46 @@
using Lantean.QBTMud.Models;
using Lantean.QBTMud.Services;
using Microsoft.AspNetCore.Components;
namespace Lantean.QBTMud.Components.Dialogs
{
public abstract class SubmittableDialog : ComponentBase, IAsyncDisposable
{
private bool _disposedValue;
[Inject]
protected IKeyboardService KeyboardService { get; set; } = default!;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await KeyboardService.RegisterKeypressEvent("Enter", k => Submit(k));
await KeyboardService.Focus();
}
}
protected abstract Task Submit(KeyboardEvent keyboardEvent);
protected virtual async ValueTask DisposeAsync(bool disposing)
{
if (!_disposedValue)
{
if (disposing)
{
await KeyboardService.UnregisterKeypressEvent("Enter");
await KeyboardService.UnFocus();
}
_disposedValue = true;
}
}
public async ValueTask DisposeAsync()
{
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
await DisposeAsync(disposing: true);
GC.SuppressFinalize(this);
}
}
}