From 282a1f7c365af09d837c833887d9c8ea2835c689 Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Mon, 20 Nov 2023 17:35:11 -0600 Subject: [PATCH] Fix authentication status label not updating after authentication --- .../LANCommanderLibraryPlugin.cs | 6 +++++- .../Views/LANCommanderSettingsView.xaml.cs | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) 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)