mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-10-23 04:52:22 +00:00
Add project files.
This commit is contained in:
38
Lantean.QBTMudBlade/Components/Options/Options.cs
Normal file
38
Lantean.QBTMudBlade/Components/Options/Options.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
{
|
||||
public abstract class Options : ComponentBase
|
||||
{
|
||||
private bool _preferencesRead;
|
||||
protected UpdatePreferences UpdatePreferences { get; set; } = new UpdatePreferences();
|
||||
|
||||
[Parameter]
|
||||
[EditorRequired]
|
||||
public Preferences? Preferences { get; set; }
|
||||
|
||||
[Parameter]
|
||||
[EditorRequired]
|
||||
public EventCallback<UpdatePreferences> PreferencesChanged { get; set; }
|
||||
|
||||
public async Task ResetAsync()
|
||||
{
|
||||
SetOptions();
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if (_preferencesRead)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_preferencesRead = SetOptions();
|
||||
}
|
||||
|
||||
protected abstract bool SetOptions();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user