mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-06-23 23:00:23 -07:00
make menu saving non-destructive (#825)
This commit is contained in:
parent
d97af69306
commit
75096e5908
20
Bloxstrap/Resources/Strings.Designer.cs
generated
20
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -134,7 +134,7 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to fetch the {0} emoji preset. Your preferred emoji type has been set back to default..
|
||||
/// Looks up a localized string similar to Could not apply the {0} emoji mod preset because of a network error. To try again, please reconfigure the option in the Bloxstrap Menu..
|
||||
/// </summary>
|
||||
public static string Bootstrapper_EmojiPresetFetchFailed {
|
||||
get {
|
||||
@ -2799,6 +2799,24 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Changes will take effect the next time you launch Roblox..
|
||||
/// </summary>
|
||||
public static string Menu_SettingsSaved_Message {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu.SettingsSaved.Message", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Settings saved!.
|
||||
/// </summary>
|
||||
public static string Menu_SettingsSaved_Title {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu.SettingsSaved.Title", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bloxstrap Menu.
|
||||
/// </summary>
|
||||
|
@ -1045,6 +1045,12 @@ Selecting 'No' will ignore this warning and continue installation.</value>
|
||||
<data name="Menu.Save" xml:space="preserve">
|
||||
<value>Save</value>
|
||||
</data>
|
||||
<data name="Menu.SettingsSaved.Message" xml:space="preserve">
|
||||
<value>Changes will take effect the next time you launch Roblox.</value>
|
||||
</data>
|
||||
<data name="Menu.SettingsSaved.Title" xml:space="preserve">
|
||||
<value>Settings saved!</value>
|
||||
</data>
|
||||
<data name="Menu.Title" xml:space="preserve">
|
||||
<value>Bloxstrap Menu</value>
|
||||
</data>
|
||||
@ -1053,4 +1059,4 @@ Selecting 'No' will ignore this warning and continue installation.</value>
|
||||
|
||||
Would you like to switch your preferred channel to {0}?</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
@ -29,6 +29,12 @@
|
||||
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:Snackbar
|
||||
x:Name="SettingsSavedSnackbar"
|
||||
Title="{x:Static resources:Strings.Menu_SettingsSaved_Title}"
|
||||
Message="{x:Static resources:Strings.Menu_SettingsSaved_Message}"
|
||||
Appearance="Primary" Icon="CheckmarkCircle32" Timeout="3000" Margin="200,0,200,20" Grid.RowSpan="10" Panel.ZIndex="9" />
|
||||
|
||||
<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" />
|
||||
|
||||
@ -85,7 +91,7 @@
|
||||
<ui:Button Content="{Binding ConfirmButtonText, Mode=OneTime}" Appearance="Primary" Command="{Binding ConfirmSettingsCommand, Mode=OneWay}" IsEnabled="{Binding ConfirmButtonEnabled, Mode=OneWay}" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem Grid.Column="2" Padding="4,0,0,0">
|
||||
<ui:Button Content="{x:Static resources:Strings.Common_Cancel}" Command="{Binding CloseWindowCommand, Mode=OneWay}" />
|
||||
<ui:Button Content="{Binding CloseButtonText, Mode=OneTime}" Command="{Binding CloseWindowCommand, Mode=OneWay}" />
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
|
@ -7,22 +7,24 @@ using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
using Wpf.Ui.Mvvm.Contracts;
|
||||
|
||||
using Bloxstrap.UI.Elements.Menu;
|
||||
using Bloxstrap.UI.Elements.Menu.Pages;
|
||||
|
||||
namespace Bloxstrap.UI.ViewModels.Menu
|
||||
{
|
||||
public class MainWindowViewModel : NotifyPropertyChangedViewModel
|
||||
{
|
||||
private readonly Window _window;
|
||||
private readonly MainWindow _window;
|
||||
|
||||
public ICommand CloseWindowCommand => new RelayCommand(CloseWindow);
|
||||
public ICommand ConfirmSettingsCommand => new RelayCommand(ConfirmSettings);
|
||||
|
||||
public Visibility NavigationVisibility { get; set; } = Visibility.Visible;
|
||||
public string ConfirmButtonText => App.IsFirstRun ? Resources.Strings.Menu_Install : Resources.Strings.Menu_Save;
|
||||
public string CloseButtonText => App.IsFirstRun ? Resources.Strings.Common_Cancel : Resources.Strings.Common_Close;
|
||||
public bool ConfirmButtonEnabled { get; set; } = true;
|
||||
|
||||
public MainWindowViewModel(Window window)
|
||||
public MainWindowViewModel(MainWindow window)
|
||||
{
|
||||
_window = window;
|
||||
}
|
||||
@ -34,8 +36,12 @@ namespace Bloxstrap.UI.ViewModels.Menu
|
||||
if (!App.IsFirstRun)
|
||||
{
|
||||
App.ShouldSaveConfigs = true;
|
||||
App.Settings.Save();
|
||||
App.State.Save();
|
||||
App.FastFlags.Save();
|
||||
CloseWindow();
|
||||
App.ShouldSaveConfigs = false;
|
||||
|
||||
_window.SettingsSavedSnackbar.Show();
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user