Merge pull request #1663 from bluepilledgreat/feature/less-obstructive-running-message-2

Use snackbar for already running warning
This commit is contained in:
pizzaboxer 2024-04-22 09:42:02 +01:00 committed by GitHub
commit 5ca4785d88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 37 additions and 15 deletions

View File

@ -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();

View File

@ -1462,11 +1462,20 @@ namespace Bloxstrap.Resources {
}
/// <summary>
/// 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..
/// </summary>
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);
}
}
/// <summary>
/// Looks up a localized string similar to Bloxstrap is already running.
/// </summary>
public static string Menu_AlreadyRunning_Title {
get {
return ResourceManager.GetString("Menu.AlreadyRunning.Title", resourceCulture);
}
}

View File

@ -590,8 +590,11 @@ Would you like to upgrade your currently installed version?</value>
<data name="Menu.AllFiles" xml:space="preserve">
<value>All files</value>
</data>
<data name="Menu.AlreadyRunning" xml:space="preserve">
<value>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.</value>
<data name="Menu.AlreadyRunning.Caption" xml:space="preserve">
<value>Please note that not all your changes will immediately apply until you close all currently open Roblox instances.</value>
</data>
<data name="Menu.AlreadyRunning.Title" xml:space="preserve">
<value>Bloxstrap is already running</value>
</data>
<data name="Menu.Appearance.Bootstrapper.Description" xml:space="preserve">
<value>You can make it look different, retro, or even just like Roblox.</value>

View File

@ -1,4 +1,4 @@
<base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.Menu.MainWindow"
<base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.Menu.MainWindow"
x:Name="ConfigurationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -24,6 +24,12 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ui:Snackbar
x:Name="AlreadyRunningSnackbar"
Title="{x:Static resources:Strings.Menu_AlreadyRunning_Title}"
Message="{x:Static resources:Strings.Menu_AlreadyRunning_Caption}"
Icon="Info20" Timeout="10000" Margin="200,0,200,20" Grid.RowSpan="10" Panel.ZIndex="10" />
<ui:TitleBar Padding="8" x:Name="RootTitleBar" Grid.Row="0" ForceShutdown="False" MinimizeToTray="False" ShowHelp="True" HelpClicked="OpenWiki" UseSnapLayout="True" Title="{x:Static resources:Strings.Menu_Title}" Icon="pack://application:,,,/Bloxstrap.ico" />
<Grid x:Name="RootGrid" Grid.Row="1" Margin="12,12,0,0" Visibility="Visible">

View File

@ -10,7 +10,7 @@ namespace Bloxstrap.UI.Elements.Menu
/// </summary>
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");

View File

@ -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)
{