private async void SignIn_OnInitialized(object sender, EventArgs e) { if (Identity.ConfExists()) { try { DialogHost.OpenControl(); await Identity.RefreshIfRequired(); } catch (ApiException exception) { SetErrorHint(exception); DialogHost.CurrentSession.Close(); return; } DialogHost.CurrentSession.Close(); var mainWindow = new MainWindow(); mainWindow.Show(); Close(); } }