From 09e019648ac4ff0bd6b2f907ed1636d34e6bab9c Mon Sep 17 00:00:00 2001 From: emeraldsingers Date: Thu, 6 Aug 2026 14:32:37 +0300 Subject: [PATCH] fix: prevent duplicate package manager windows --- OpenUtau/Views/MainWindow.axaml.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/OpenUtau/Views/MainWindow.axaml.cs b/OpenUtau/Views/MainWindow.axaml.cs index e895c1d5a..b1d1746ec 100644 --- a/OpenUtau/Views/MainWindow.axaml.cs +++ b/OpenUtau/Views/MainWindow.axaml.cs @@ -610,9 +610,20 @@ async void OnMenuInstallSinger(object sender, RoutedEventArgs args) { void OnMenuPackageManager(object sender, RoutedEventArgs args) { try { - var dialog = new PackageManagerDialog() { DataContext = new PackageManagerViewModel() }; - dialog.Show(); + var desktop = Application.Current?.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime; + if (desktop == null) { + return; + } + var dialog = desktop.Windows.FirstOrDefault(w => w is PackageManagerDialog) as PackageManagerDialog; + if (dialog == null) { + dialog = new PackageManagerDialog() { DataContext = new PackageManagerViewModel() }; + } if (dialog.Position.Y < 0) dialog.Position = dialog.Position.WithY(0); + if (dialog.WindowState == WindowState.Minimized) { + dialog.WindowState = WindowState.Normal; + } + dialog.Show(); + dialog.Activate(); } catch (Exception e) { DocManager.Inst.ExecuteCmd(new ErrorMessageNotification(e)); }