@page "/user-options" @attribute [Authorize] @inherits AuthComponentBase @inject AuthenticationStateProvider AuthProvider @inject UserManager UserManager @inject IDataService DataService @inject IToastService ToastService @inject IModalService ModalService

User Options

@if (!string.IsNullOrWhiteSpace(_alertMessage)) { }



@foreach (var setting in Enum.GetValues(typeof(Theme))) { }
* Requires browser refresh.








@code { private RemotelyUser _user; private RemotelyUserOptions _options; private string _alertMessage; protected override async Task OnInitializedAsync() { var authState = await AuthProvider.GetAuthenticationStateAsync(); _user = await UserManager.GetUserAsync(authState.User); _options = _user.UserOptions; await base.OnInitializedAsync(); } private Task HandleValidSubmit() { if (!_options.CommandModeShortcutBash.StartsWith("/")) { _options.CommandModeShortcutBash = "/" + _options.CommandModeShortcutBash; } if (!_options.CommandModeShortcutCMD.StartsWith("/")) { _options.CommandModeShortcutCMD = "/" + _options.CommandModeShortcutCMD; } if (!_options.CommandModeShortcutPSCore.StartsWith("/")) { _options.CommandModeShortcutPSCore = "/" + _options.CommandModeShortcutPSCore; } if (!_options.CommandModeShortcutWinPS.StartsWith("/")) { _options.CommandModeShortcutWinPS = "/" + _options.CommandModeShortcutWinPS; } DataService.UpdateUserOptions(_user.UserName, _options); _alertMessage = "Options saved"; ToastService.ShowToast("Options saved."); return Task.CompletedTask; } private void EditFormKeyDown() { _alertMessage = ""; } private void ShowShortcutHelp() { var modalText = @"The shell shortcuts are used to quickly switch between terminal shells on the main page. If you type one of these shortcuts into the terminal, it will select the corresponding command mode (e.g. PowerShell Core, Bash, etc.)."; ModalService.ShowModal("Shell Shortcuts", new[] { modalText }); } }