From c9a23ac4783cdcba764dd9e245ac46e0e0059e72 Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Sun, 21 Apr 2024 19:46:58 +0100 Subject: [PATCH] use snackbar for already running warning --- Bloxstrap/App.xaml.cs | 9 ++------- Bloxstrap/Resources/Strings.Designer.cs | 15 ++++++++++++--- Bloxstrap/Resources/Strings.resx | 7 +++++-- Bloxstrap/UI/Elements/Menu/MainWindow.xaml | 8 +++++++- Bloxstrap/UI/Elements/Menu/MainWindow.xaml.cs | 11 ++++++++++- Bloxstrap/UI/Frontend.cs | 2 +- 6 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index f6e7072..ddbcc5e 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -175,13 +175,8 @@ namespace Bloxstrap } else { - if (Process.GetProcessesByName(ProjectName).Length > 1 && !LaunchSettings.IsQuiet) - Frontend.ShowMessageBox( - Bloxstrap.Resources.Strings.Menu_AlreadyRunning, - MessageBoxImage.Information - ); - - Frontend.ShowMenu(); + bool showAlreadyRunningWarning = Process.GetProcessesByName(ProjectName).Length > 1 && !LaunchSettings.IsQuiet; + Frontend.ShowMenu(showAlreadyRunningWarning); } StartupFinished(); diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index 4f01855..194e71a 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -1462,11 +1462,20 @@ namespace Bloxstrap.Resources { } /// - /// Looks up a localized string similar to Bloxstrap is currently running, likely as a background Roblox process. Please note that not all your changes will immediately apply until you close all currently open Roblox instances.. + /// Looks up a localized string similar to Please note that not all your changes will immediately apply until you close all currently open Roblox instances.. /// - public static string Menu_AlreadyRunning { + public static string Menu_AlreadyRunning_Caption { get { - return ResourceManager.GetString("Menu.AlreadyRunning", resourceCulture); + return ResourceManager.GetString("Menu.AlreadyRunning.Caption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bloxstrap is already running. + /// + public static string Menu_AlreadyRunning_Title { + get { + return ResourceManager.GetString("Menu.AlreadyRunning.Title", resourceCulture); } } diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index afaea78..39e5524 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -590,8 +590,11 @@ Would you like to upgrade your currently installed version? All files - - Bloxstrap is currently running, likely as a background Roblox process. Please note that not all your changes will immediately apply until you close all currently open Roblox instances. + + Please note that not all your changes will immediately apply until you close all currently open Roblox instances. + + + Bloxstrap is already running You can make it look different, retro, or even just like Roblox. diff --git a/Bloxstrap/UI/Elements/Menu/MainWindow.xaml b/Bloxstrap/UI/Elements/Menu/MainWindow.xaml index ad73178..86a1ce1 100644 --- a/Bloxstrap/UI/Elements/Menu/MainWindow.xaml +++ b/Bloxstrap/UI/Elements/Menu/MainWindow.xaml @@ -1,4 +1,4 @@ - + + diff --git a/Bloxstrap/UI/Elements/Menu/MainWindow.xaml.cs b/Bloxstrap/UI/Elements/Menu/MainWindow.xaml.cs index dfa4e1f..4f317fc 100644 --- a/Bloxstrap/UI/Elements/Menu/MainWindow.xaml.cs +++ b/Bloxstrap/UI/Elements/Menu/MainWindow.xaml.cs @@ -10,7 +10,7 @@ namespace Bloxstrap.UI.Elements.Menu /// public partial class MainWindow : INavigationWindow { - public MainWindow() + public MainWindow(bool showAlreadyRunningWarning) { InitializeComponent(); ApplyTheme(); @@ -22,6 +22,15 @@ namespace Bloxstrap.UI.Elements.Menu #if DEBUG // easier access PreInstallNavItem.Visibility = System.Windows.Visibility.Visible; #endif + + if (showAlreadyRunningWarning) + _ = ShowAlreadyRunningSnackbar(); + } + + private async Task ShowAlreadyRunningSnackbar() + { + await Task.Delay(500); // wait for everything to finish loading + AlreadyRunningSnackbar.Show(); } public void OpenWiki(object? sender, EventArgs e) => Utilities.ShellExecute($"https://github.com/{App.ProjectRepository}/wiki"); diff --git a/Bloxstrap/UI/Frontend.cs b/Bloxstrap/UI/Frontend.cs index 1561f7f..c4ddeef 100644 --- a/Bloxstrap/UI/Frontend.cs +++ b/Bloxstrap/UI/Frontend.cs @@ -8,7 +8,7 @@ namespace Bloxstrap.UI { static class Frontend { - public static void ShowMenu() => new MainWindow().ShowDialog(); + public static void ShowMenu(bool showAlreadyRunningWarning = false) => new MainWindow(showAlreadyRunningWarning).ShowDialog(); public static MessageBoxResult ShowMessageBox(string message, MessageBoxImage icon = MessageBoxImage.None, MessageBoxButton buttons = MessageBoxButton.OK, MessageBoxResult defaultResult = MessageBoxResult.None) {