Add info prompt before initial installation

Also fixed a bug with config saving being handled incorrectly
This commit is contained in:
pizzaboxer 2023-02-05 10:18:32 +00:00
parent 3143b17666
commit d468157488
4 changed files with 35 additions and 14 deletions

View File

@ -118,7 +118,6 @@ namespace Bloxstrap
// just in case the user decides to cancel the install
if (!IsFirstRun)
{
ShouldSaveConfigs = true;
Settings.Load();
State.Load();
}
@ -142,7 +141,6 @@ namespace Bloxstrap
}
#endif
//new Preferences().ShowDialog();
new MainWindow().ShowDialog();
}
else if (LaunchArgs[0].StartsWith("roblox-player:"))
@ -165,6 +163,9 @@ namespace Bloxstrap
if (!String.IsNullOrEmpty(commandLine))
{
if (!IsFirstRun)
ShouldSaveConfigs = true;
DeployManager.Channel = Settings.Prop.Channel;
Settings.Prop.BootstrapperStyle.Show(new Bootstrapper(commandLine));
}

View File

@ -1,17 +1,18 @@
using System.IO;
using System;
using System;
using System.IO;
using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Input;
using Bloxstrap.Views;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Win32;
using CommunityToolkit.Mvvm.Input;
using Wpf.Ui.Controls.Interfaces;
using Wpf.Ui.Mvvm.Contracts;
namespace Bloxstrap.ViewModels
{
public class MainWindowViewModel
{
private readonly Window _window;
private readonly IDialogService _dialogService;
private readonly string _originalBaseDirectory = App.BaseDirectory; // we need this to check if the basedirectory changes
public ICommand CloseWindowCommand => new RelayCommand(CloseWindow);
@ -19,9 +20,10 @@ namespace Bloxstrap.ViewModels
public string ConfirmButtonText => App.IsFirstRun ? "Install" : "Save";
public MainWindowViewModel(Window window)
public MainWindowViewModel(Window window, IDialogService dialogService)
{
_window = window;
_dialogService = dialogService;
}
private void CloseWindow() => _window.Close();
@ -83,15 +85,29 @@ namespace Bloxstrap.ViewModels
// preserve settings
// we don't need to copy the bootstrapper over since the install process will do that automatically
App.Settings.Save();
//File.Copy(Path.Combine(App.BaseDirectory, "Settings.json"), Path.Combine(App.BaseDirectory, "Settings.json"));
// App.Settings.Save();
// File.Copy(Path.Combine(App.BaseDirectory, "Settings.json"), Path.Combine(App.BaseDirectory, "Settings.json"));
}
CloseWindow();
}
else
{
IDialogControl dialogControl = _dialogService.GetDialogControl();
App.IsSetupComplete = true;
dialogControl.ButtonRightClick += (_, _) =>
{
dialogControl.Hide();
App.IsSetupComplete = true;
CloseWindow();
};
CloseWindow();
dialogControl.ShowAndWaitAsync(
"Before you install",
"After installation, you can open the menu again by searching for it in the Start menu.\n" +
"If you want to revert back to the original Roblox launcher, just uninstall Bloxstrap and it will automatically revert."
);
}
}
}
}

View File

@ -97,5 +97,7 @@
<ui:Button Content="Cancel" Command="{Binding CloseWindowCommand, Mode=OneWay}" />
</StatusBarItem>
</StatusBar>
<ui:Dialog x:Name="RootDialog" Title="WPF UI" Grid.Row="1" Grid.RowSpan="2" ButtonLeftVisibility="Collapsed" ButtonRightName="Continue" DialogHeight="225" DialogWidth="430" />
</Grid>
</ui:UiWindow>

View File

@ -15,12 +15,14 @@ namespace Bloxstrap.Views
public partial class MainWindow : INavigationWindow
{
private readonly IThemeService _themeService = new ThemeService();
private readonly IDialogService _dialogService = new DialogService();
public MainWindow()
{
DataContext = new MainWindowViewModel(this);
DataContext = new MainWindowViewModel(this, _dialogService);
SetTheme();
InitializeComponent();
_dialogService.SetDialogControl(RootDialog);
}
public void SetTheme()