Fix authentication status label not updating after authentication

net8.0
Pat Hartl 2023-11-20 17:35:11 -06:00
parent 5e3384b4fd
commit 282a1f7c36
2 changed files with 6 additions and 4 deletions

View File

@ -436,7 +436,7 @@ namespace LANCommander.PlaynitePlugin
Logger.Trace("Name change was cancelled");
}
public Window ShowAuthenticationWindow(string serverAddress = null)
public Window ShowAuthenticationWindow(string serverAddress = null, EventHandler onClose = null)
{
Window window = null;
Application.Current.Dispatcher.Invoke((Action)delegate
@ -458,6 +458,10 @@ namespace LANCommander.PlaynitePlugin
window.Owner = PlayniteApi.Dialogs.GetCurrentAppWindow();
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.ResizeMode = ResizeMode.NoResize;
if (onClose != null)
window.Closed += onClose;
window.ShowDialog();
});

View File

@ -81,9 +81,7 @@ namespace LANCommander.PlaynitePlugin
private void AuthenticateButton_Click(object sender, RoutedEventArgs e)
{
var authWindow = Plugin.ShowAuthenticationWindow();
authWindow.Closed += AuthWindow_Closed;
var authWindow = Plugin.ShowAuthenticationWindow(Settings.ServerAddress, AuthWindow_Closed);
}
private void DisconnectButton_Click(object sender, RoutedEventArgs e)