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 bool UserIsLoggedIn = false; protected override void OnInitialized() { 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); } } }