@using LANCommander.Client.Models @using Photino.Blazor.CustomWindow.Components @inherits LayoutComponentBase @inject ImportService ImportService @inject ProfileService ProfileService @inject IMessageService MessageService @inject NavigationManager NavigationManager @inject ModalService ModalService } @Body @code { Settings Settings = null; bool Importing = false; protected override async Task OnInitializedAsync() { Settings = SettingService.GetSettings(); } async Task Logout() { await ProfileService.Logout(); NavigationManager.NavigateTo("/Authenticate", true); } async Task ChangeAlias() { var settings = SettingService.GetSettings(); var modalOptions = new ModalOptions() { Title = "Change Name", Maximizable = false, DefaultMaximized = false, Closable = true, Centered = true }; var modalRef = ModalService.CreateModal(modalOptions, settings.Profile.Alias); modalRef.OnOk = async (newName) => { await ProfileService.ChangeAlias(newName); Settings = SettingService.GetSettings(); await InvokeAsync(StateHasChanged); }; } async void Import() { var config = new MessageConfig() { Content = "Importing...", Duration = 0 }; Importing = true; var task = MessageService.Loading(config); await ImportService.ImportAsync(); task.Start(); Importing = true; } }