From 6634b3d97ab0e58f1c2fbcad4054ad3cc94dd2da Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Jan 2026 12:40:31 +0000 Subject: [PATCH 1/3] Fix chat window not showing when reopened after being closed When the user closed the chat window with the X button, the window was hidden instead of closed to preserve state. However, when trying to reopen it, the parent ViewModel would call Activate() on the existing WindowHandle, which only activated the window without showing it first. This caused the window to remain hidden. The fix ensures that WindowHandle.Activate() calls Show() before Activate() to make the window visible, similar to ChatView.ShowAndActivate(). --- src/RemoteViewer.Client/Services/Dialogs/WindowHandle.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/RemoteViewer.Client/Services/Dialogs/WindowHandle.cs b/src/RemoteViewer.Client/Services/Dialogs/WindowHandle.cs index ef9eb56..7e59211 100644 --- a/src/RemoteViewer.Client/Services/Dialogs/WindowHandle.cs +++ b/src/RemoteViewer.Client/Services/Dialogs/WindowHandle.cs @@ -29,6 +29,7 @@ public void Activate() if (this._window is null) return; + this._window.Show(); this._window.Activate(); } From 4ff91456e4fafeeb9ce50dc16b2cb0de37f49abc Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Jan 2026 12:43:07 +0000 Subject: [PATCH 2/3] Simplify chat window closing - remove hide workaround Removed the workaround that hid the chat window instead of closing it. The window now closes normally when the user clicks X, which is simpler and cleaner. When reopened, a fresh window and ViewModel are created. Changes: - Removed _forceClose field and ForceClose() method from ChatView - Simplified OnClosing to perform cleanup and allow normal close - Reverted WindowHandle.Activate() to not call Show() (no longer needed) --- .../Services/Dialogs/WindowHandle.cs | 1 - .../Views/Chat/ChatView.axaml.cs | 26 +++---------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/RemoteViewer.Client/Services/Dialogs/WindowHandle.cs b/src/RemoteViewer.Client/Services/Dialogs/WindowHandle.cs index 7e59211..ef9eb56 100644 --- a/src/RemoteViewer.Client/Services/Dialogs/WindowHandle.cs +++ b/src/RemoteViewer.Client/Services/Dialogs/WindowHandle.cs @@ -29,7 +29,6 @@ public void Activate() if (this._window is null) return; - this._window.Show(); this._window.Activate(); } diff --git a/src/RemoteViewer.Client/Views/Chat/ChatView.axaml.cs b/src/RemoteViewer.Client/Views/Chat/ChatView.axaml.cs index a62cdb9..ce1778e 100644 --- a/src/RemoteViewer.Client/Views/Chat/ChatView.axaml.cs +++ b/src/RemoteViewer.Client/Views/Chat/ChatView.axaml.cs @@ -8,7 +8,6 @@ namespace RemoteViewer.Client.Views.Chat; public partial class ChatView : Window { private ChatViewModel? _viewModel; - private bool _forceClose; public ChatView() { @@ -18,12 +17,6 @@ public ChatView() this.Deactivated += this.OnDeactivated; } - public void ForceClose() - { - this._forceClose = true; - this.Close(); - } - public void ShowAndActivate() { this.Show(); @@ -77,23 +70,12 @@ protected override void OnClosing(WindowClosingEventArgs e) { base.OnClosing(e); - if (this._forceClose) + if (this._viewModel is { } vm) { - // Dispose ViewModel and cleanup - if (this._viewModel is { } vm) - { - vm.Messages.CollectionChanged -= this.Messages_CollectionChanged; - vm.Dispose(); - } - return; + vm.Messages.CollectionChanged -= this.Messages_CollectionChanged; + vm.IsOpen = false; + vm.Dispose(); } - - // Hide instead of close to preserve state - e.Cancel = true; - this.Hide(); - - if (this._viewModel is { } vm2) - vm2.IsOpen = false; } private void Messages_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) From fddf106798e748072339cc9b37d6006e3d7ca8fe Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Jan 2026 13:18:51 +0000 Subject: [PATCH 3/3] Remove unused ShowAndActivate method from ChatView The ShowAndActivate method was only used when creating new chat windows, where the minimized state check was unnecessary. Simplified by calling Show() and Activate() directly in the dialog service. --- .../Services/Dialogs/AvaloniaDialogService.cs | 3 ++- src/RemoteViewer.Client/Views/Chat/ChatView.axaml.cs | 11 ----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/RemoteViewer.Client/Services/Dialogs/AvaloniaDialogService.cs b/src/RemoteViewer.Client/Services/Dialogs/AvaloniaDialogService.cs index a52193a..a551059 100644 --- a/src/RemoteViewer.Client/Services/Dialogs/AvaloniaDialogService.cs +++ b/src/RemoteViewer.Client/Services/Dialogs/AvaloniaDialogService.cs @@ -88,7 +88,8 @@ public IWindowHandle ShowChatWindow(ChatViewModel viewModel) { DataContext = viewModel }; - window.ShowAndActivate(); + window.Show(); + window.Activate(); return new WindowHandle(window); }); } diff --git a/src/RemoteViewer.Client/Views/Chat/ChatView.axaml.cs b/src/RemoteViewer.Client/Views/Chat/ChatView.axaml.cs index ce1778e..0221135 100644 --- a/src/RemoteViewer.Client/Views/Chat/ChatView.axaml.cs +++ b/src/RemoteViewer.Client/Views/Chat/ChatView.axaml.cs @@ -17,17 +17,6 @@ public ChatView() this.Deactivated += this.OnDeactivated; } - public void ShowAndActivate() - { - this.Show(); - - // Restore from minimized state if needed - if (this.WindowState == WindowState.Minimized) - this.WindowState = WindowState.Normal; - - this.Activate(); - } - private void OnDataContextChanged(object? sender, EventArgs e) { if (this._viewModel is not null)