mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-10-22 20:42:24 +00:00
59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
using Lantean.QBitTorrentClient;
|
|
using Lantean.QBTMud.Models;
|
|
using Microsoft.AspNetCore.Components;
|
|
using MudBlazor;
|
|
|
|
namespace Lantean.QBTMud.Components.Dialogs
|
|
{
|
|
public partial class CategoryPropertiesDialog
|
|
{
|
|
private string _savePath = string.Empty;
|
|
|
|
[CascadingParameter]
|
|
private IMudDialogInstance MudDialog { get; set; } = default!;
|
|
|
|
[Inject]
|
|
protected IApiClient ApiClient { get; set; } = default!;
|
|
|
|
[Parameter]
|
|
public string? Category { get; set; }
|
|
|
|
[Parameter]
|
|
public string? SavePath { get; set; }
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
var preferences = await ApiClient.GetApplicationPreferences();
|
|
_savePath = preferences.SavePath;
|
|
|
|
SavePath ??= _savePath;
|
|
}
|
|
|
|
protected void Cancel()
|
|
{
|
|
MudDialog.Cancel();
|
|
}
|
|
|
|
protected void Submit()
|
|
{
|
|
if (Category is null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(SavePath))
|
|
{
|
|
SavePath = _savePath;
|
|
}
|
|
|
|
MudDialog.Close(DialogResult.Ok(new Category(Category, SavePath)));
|
|
}
|
|
|
|
protected override Task Submit(KeyboardEvent keyboardEvent)
|
|
{
|
|
Submit();
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
} |