diff --git a/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs b/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs index 5d069e5..5c12d2c 100644 --- a/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs +++ b/LANCommander.Playnite.Extension/LANCommanderLibraryPlugin.cs @@ -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(); }); diff --git a/LANCommander.Playnite.Extension/Views/LANCommanderSettingsView.xaml.cs b/LANCommander.Playnite.Extension/Views/LANCommanderSettingsView.xaml.cs index 44526a0..ef2063d 100644 --- a/LANCommander.Playnite.Extension/Views/LANCommanderSettingsView.xaml.cs +++ b/LANCommander.Playnite.Extension/Views/LANCommanderSettingsView.xaml.cs @@ -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)