@page "/settings" @attribute [Authorize] @inject IUserSessionService Session @rendermode InteractiveServer

Settings

Display
Behavior
@if (_saved) {
Settings saved.
} @code { private string _lang = "en", _theme = "System"; private bool _autoTakeOwnership, _saved; protected override void OnInitialized() { var s = Session.Settings; _lang = s.Lang; _theme = s.Theme; _autoTakeOwnership = s.AutoTakeOwnership; } private void Save() { Session.UpdateSettings(new AppSettings { Lang = _lang, Theme = _theme, AutoTakeOwnership = _autoTakeOwnership }); SharepointToolbox.Web.Localization.TranslationSource.Instance.SetCulture(_lang); _saved = true; StateHasChanged(); _ = Task.Delay(2000).ContinueWith(_ => { _saved = false; InvokeAsync(StateHasChanged); }); } }