using AyCode.Blazor.Components; using AyCode.Interfaces.StorageHandlers; using Microsoft.AspNetCore.Components; using Microsoft.Extensions.Localization; using TIAMSharedUI.Pages.Components; using TIAMSharedUI.Resources; using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Models.ClientSide; namespace TIAMSharedUI.Pages { public partial class Settings : ComponentBase { [Inject] public ISecureStorageHandler? secureStorageHandler { get; set; } [Inject] public IStringLocalizer? localizer { get; set; } [Inject] public ISessionService sessionService { get; set; } public string Language { get; set; } = "en-US"; private AuthComponent Auth; private bool UserIsLoggedIn = false; protected override async Task OnInitializedAsync() { base.OnInitialized(); UserIsLoggedIn = sessionService.IsAuthenticated; GetCurrentSettings(); } public void SaveSettings() { secureStorageHandler.SaveToSecureStorageAsync(Setting.Locale, "hu-HU"); } public void GetCurrentSettings() { secureStorageHandler.GetFromSecureStorageAsync(Setting.Locale); } public void ResetSettings() { secureStorageHandler.DeleteFromSecureStorageAsync(Setting.Locale); } } }