Skip to content

Commit 81584f8

Browse files
committed
Fixed Interface Manager
Copilot Dock now shows if re-opened
1 parent 58ab3b1 commit 81584f8

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

GoAwayEdge/Common/Runtime/NamedPipeManager.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,6 @@ public void SendMessage(string message)
110110
}
111111
}
112112

113-
114-
public void StopServer()
115-
{
116-
_isServerRunning = false;
117-
_pipeThread?.Join(); // Wait for ending tasks
118-
}
119-
120113
private void HandleError(Exception ex)
121114
{
122115
Logging.Log($"Pipe error: {ex.Message}", Logging.LogLevel.ERROR);

GoAwayEdge/UserInterface/CopilotDock/CopilotDock.xaml.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private void CloseButton_OnClick(object sender, RoutedEventArgs e)
6868
{
6969
Configuration.ShellManager.AppBarManager.SignalGracefulShutdown();
7070
Configuration.ShellManager.Dispose();
71-
this.Close();
71+
Environment.Exit(0);
7272
}
7373

7474
private void DockButton_OnClick(object sender, RoutedEventArgs e)
@@ -92,9 +92,8 @@ private void CopilotDock_OnDeactivated(object? sender, EventArgs e)
9292
{
9393
if (Configuration.AppBarIsAttached) return;
9494
var currentProcess = Process.GetCurrentProcess();
95-
var currentTitle = currentProcess.MainWindowTitle;
9695
var currentId = currentProcess.Id;
97-
Logging.Log($"Deactivated CopilotDock (ID: {currentId}, Title: {currentTitle})", Logging.LogLevel.INFO);
96+
Logging.Log($"Deactivated CopilotDock (PID: {currentId})");
9897
WindowManager.HideCopilotDock();
9998
}
10099
}

GoAwayEdge/UserInterface/CopilotDock/InterfaceManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using GoAwayEdge.Common.Debugging;
33
using GoAwayEdge.Common.Runtime;
44
using ManagedShell.AppBar;
5+
using System.Windows;
6+
using ManagedShell;
57

68
namespace GoAwayEdge.UserInterface.CopilotDock
79
{
@@ -46,7 +48,7 @@ public static void ShowDock()
4648
Logging.Log($"Message received: {message}");
4749
if (message.Contains("BringToFront"))
4850
{
49-
WindowManager.ShowHiddenCopilotDock();
51+
WindowManager.ShowCopilotDockAsync(Common.Configuration.ShellManager, AppBarScreen.FromPrimaryScreen(), AppBarEdge.Right, 500, mode);
5052
}
5153
};
5254

GoAwayEdge/UserInterface/CopilotDock/WindowManager.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace GoAwayEdge.UserInterface.CopilotDock;
99
public static class WindowManager
1010
{
1111
private static CopilotDock? _copilotDockInstance;
12-
private static TaskCompletionSource<bool>? _closeCompletionSource;
1312

1413
public static void ShowCopilotDockAsync(ShellManager shellManager, AppBarScreen screen, AppBarEdge edge, double desiredHeight, AppBarMode mode)
1514
{
@@ -29,27 +28,29 @@ public static void ShowCopilotDockAsync(ShellManager shellManager, AppBarScreen
2928
}
3029
else
3130
{
32-
_copilotDockInstance.Show();
33-
_copilotDockInstance.Activate();
31+
Application.Current.Dispatcher.Invoke(() =>
32+
{
33+
_copilotDockInstance.Show();
34+
_copilotDockInstance.Activate();
35+
});
3436
}
3537
}
3638

3739
private static void OnCopilotDockClosed(object sender, System.EventArgs e)
3840
{
39-
_closeCompletionSource?.TrySetResult(true);
4041
if (_copilotDockInstance != null) _copilotDockInstance.Closed -= OnCopilotDockClosed!;
4142
_copilotDockInstance = null;
4243
}
4344

4445
public static void HideCopilotDock()
4546
{
46-
_copilotDockInstance?.Hide();
47-
}
48-
49-
public static void ShowHiddenCopilotDock()
50-
{
51-
if (_copilotDockInstance is not { IsVisible: false }) return;
52-
_copilotDockInstance.Show();
53-
_copilotDockInstance.Activate();
47+
try
48+
{
49+
_copilotDockInstance?.Hide();
50+
}
51+
catch (Exception ex)
52+
{
53+
Logging.Log("Failed to hide Copilot Dock: " + ex.Message);
54+
}
5455
}
5556
}

0 commit comments

Comments
 (0)