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:
58
Lantean.QBTMudBlade/Components/Menu.razor.cs
Normal file
58
Lantean.QBTMudBlade/Components/Menu.razor.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using MudBlazor;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
public partial class Menu
|
||||
{
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
protected IDialogService DialogService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
protected IApiClient ApiClient { get; set; } = default!;
|
||||
|
||||
protected async Task ResetWebUI()
|
||||
{
|
||||
var preferences = new UpdatePreferences
|
||||
{
|
||||
AlternativeWebuiPath = null,
|
||||
AlternativeWebuiEnabled = false,
|
||||
};
|
||||
|
||||
await ApiClient.SetApplicationPreferences(preferences);
|
||||
|
||||
NavigationManager.NavigateTo("/", true);
|
||||
}
|
||||
|
||||
protected void Settings()
|
||||
{
|
||||
NavigationManager.NavigateTo("/options");
|
||||
}
|
||||
|
||||
protected void Statistics()
|
||||
{
|
||||
NavigationManager.NavigateTo("/statistics");
|
||||
}
|
||||
|
||||
protected async Task Logout()
|
||||
{
|
||||
await DialogService.ShowConfirmDialog("Logout?", "Are you sure you want to logout?", async () =>
|
||||
{
|
||||
await ApiClient.Logout();
|
||||
|
||||
NavigationManager.NavigateTo("/login", true);
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task Exit()
|
||||
{
|
||||
await DialogService.ShowConfirmDialog("Quit?", "Are you sure you want to exit qBittorrent?", ApiClient.Shutdown);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user