From 0d5be93616b6b978af4eeb59f9bbba5c5a7ede17 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Thu, 5 Sep 2024 11:14:46 +0100 Subject: [PATCH] Fix some other things --- Bloxstrap/Installer.cs | 2 +- Bloxstrap/Integrations/ActivityWatcher.cs | 2 +- .../ContextMenu/MenuContainer.xaml.cs | 21 ++++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Bloxstrap/Installer.cs b/Bloxstrap/Installer.cs index c08c45f..e807455 100644 --- a/Bloxstrap/Installer.cs +++ b/Bloxstrap/Installer.cs @@ -494,7 +494,7 @@ namespace Bloxstrap string oldStartPath = Path.Combine(Paths.WindowsStartMenu, "Bloxstrap"); if (File.Exists(oldDesktopPath)) - File.Move(oldDesktopPath, DesktopShortcut); + File.Move(oldDesktopPath, DesktopShortcut, true); if (Directory.Exists(oldStartPath)) { diff --git a/Bloxstrap/Integrations/ActivityWatcher.cs b/Bloxstrap/Integrations/ActivityWatcher.cs index c772397..78a927d 100644 --- a/Bloxstrap/Integrations/ActivityWatcher.cs +++ b/Bloxstrap/Integrations/ActivityWatcher.cs @@ -226,7 +226,7 @@ namespace Bloxstrap.Integrations { var lastActivity = History.First(); - if (lastActivity is not null && Data.UniverseId == lastActivity.UniverseId && Data.IsTeleport) + if (Data.UniverseId == lastActivity.UniverseId && Data.IsTeleport) Data.RootActivity = lastActivity.RootActivity ?? lastActivity; } } diff --git a/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs b/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs index 25f1d68..388752e 100644 --- a/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs +++ b/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs @@ -28,6 +28,8 @@ namespace Bloxstrap.UI.Elements.ContextMenu private ServerInformation? _serverInformationWindow; + private ServerHistory? _gameHistoryWindow; + public MenuContainer(Watcher watcher) { InitializeComponent(); @@ -51,14 +53,14 @@ namespace Bloxstrap.UI.Elements.ContextMenu { if (_serverInformationWindow is null) { - _serverInformationWindow = new ServerInformation(_watcher); + _serverInformationWindow = new(_watcher); _serverInformationWindow.Closed += (_, _) => _serverInformationWindow = null; } if (!_serverInformationWindow.IsVisible) - _serverInformationWindow.Show(); - - _serverInformationWindow.Activate(); + _serverInformationWindow.ShowDialog(); + else + _serverInformationWindow.Activate(); } public void ActivityWatcher_OnLogOpen(object? sender, EventArgs e) => @@ -135,7 +137,16 @@ namespace Bloxstrap.UI.Elements.ContextMenu if (_activityWatcher is null) throw new ArgumentNullException(nameof(_activityWatcher)); - new ServerHistory(_activityWatcher).ShowDialog(); + if (_gameHistoryWindow is null) + { + _gameHistoryWindow = new(_activityWatcher); + _gameHistoryWindow.Closed += (_, _) => _gameHistoryWindow = null; + } + + if (!_gameHistoryWindow.IsVisible) + _gameHistoryWindow.ShowDialog(); + else + _gameHistoryWindow.Activate(); } } }