diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs
index 5af684d..3a3e45e 100644
--- a/Bloxstrap/Bootstrapper.cs
+++ b/Bloxstrap/Bootstrapper.cs
@@ -336,6 +336,8 @@ namespace Bloxstrap
return;
}
+ App.NotifyIcon?.SetProcessId(gameClientPid);
+
if (App.Settings.Prop.EnableActivityTracking)
{
activityWatcher = new();
diff --git a/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml b/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml
index 58d48b3..57365d5 100644
--- a/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml
+++ b/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml
@@ -61,6 +61,7 @@
+
diff --git a/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs b/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs
index f2b8df0..00bbb0f 100644
--- a/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs
+++ b/Bloxstrap/UI/Elements/ContextMenu/MenuContainer.xaml.cs
@@ -26,14 +26,16 @@ namespace Bloxstrap.UI.Elements.ContextMenu
private LogTracer? _logTracerWindow;
private ServerInformation? _serverInformationWindow;
+ private int? _processId;
- public MenuContainer(ActivityWatcher? activityWatcher, DiscordRichPresence? richPresenceHandler)
+ public MenuContainer(ActivityWatcher? activityWatcher, DiscordRichPresence? richPresenceHandler, int? processId)
{
InitializeComponent();
ApplyTheme();
_activityWatcher = activityWatcher;
_richPresenceHandler = richPresenceHandler;
+ _processId = processId;
if (_activityWatcher is not null)
{
@@ -47,6 +49,9 @@ namespace Bloxstrap.UI.Elements.ContextMenu
if (_richPresenceHandler is not null)
RichPresenceMenuItem.Visibility = Visibility.Visible;
+ if (_processId is not null)
+ CloseRobloxMenuItem.Visibility = Visibility.Visible;
+
VersionTextBlock.Text = $"{App.ProjectName} v{App.Version}";
}
@@ -118,5 +123,21 @@ namespace Bloxstrap.UI.Elements.ContextMenu
_logTracerWindow.Activate();
}
+
+ private void CloseRobloxMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ MessageBoxResult result = Controls.ShowMessageBox(
+ "Are you sure you want to close Roblox?",
+ MessageBoxImage.Warning,
+ MessageBoxButton.YesNo
+ );
+
+ if (result != MessageBoxResult.Yes)
+ return;
+
+ using Process process = Process.GetProcessById((int)_processId!);
+ process.CloseMainWindow();
+ process.Close();
+ }
}
}
diff --git a/Bloxstrap/UI/NotifyIconWrapper.cs b/Bloxstrap/UI/NotifyIconWrapper.cs
index 6eb8e06..8ed8fea 100644
--- a/Bloxstrap/UI/NotifyIconWrapper.cs
+++ b/Bloxstrap/UI/NotifyIconWrapper.cs
@@ -16,6 +16,7 @@ namespace Bloxstrap.UI
private ActivityWatcher? _activityWatcher;
private DiscordRichPresence? _richPresenceHandler;
+ private int? _processId;
EventHandler? _alertClickHandler;
@@ -52,6 +53,14 @@ namespace Bloxstrap.UI
if (App.Settings.Prop.ShowServerDetails)
_activityWatcher.OnGameJoin += (_, _) => Task.Run(OnGameJoin);
}
+
+ public void SetProcessId(int processId)
+ {
+ if (_processId is not null)
+ return;
+
+ _processId = processId;
+ }
#endregion
#region Context menu
@@ -62,7 +71,7 @@ namespace Bloxstrap.UI
App.Logger.WriteLine("NotifyIconWrapper::InitializeContextMenu", "Initializing context menu");
- _menuContainer = new(_activityWatcher, _richPresenceHandler);
+ _menuContainer = new(_activityWatcher, _richPresenceHandler, _processId);
_menuContainer.ShowDialog();
}