diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index 7c8a1bb..6f57fce 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -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)); } diff --git a/Bloxstrap/ViewModels/MainWindowViewModel.cs b/Bloxstrap/ViewModels/MainWindowViewModel.cs index ed1308c..d0b9c72 100644 --- a/Bloxstrap/ViewModels/MainWindowViewModel.cs +++ b/Bloxstrap/ViewModels/MainWindowViewModel.cs @@ -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." + ); + } } } } diff --git a/Bloxstrap/Views/MainWindow.xaml b/Bloxstrap/Views/MainWindow.xaml index 96221c7..857695a 100644 --- a/Bloxstrap/Views/MainWindow.xaml +++ b/Bloxstrap/Views/MainWindow.xaml @@ -97,5 +97,7 @@ + + diff --git a/Bloxstrap/Views/MainWindow.xaml.cs b/Bloxstrap/Views/MainWindow.xaml.cs index aea3d2a..7ec6dfd 100644 --- a/Bloxstrap/Views/MainWindow.xaml.cs +++ b/Bloxstrap/Views/MainWindow.xaml.cs @@ -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()