diff --git a/Bloxstrap/Bloxstrap.csproj b/Bloxstrap/Bloxstrap.csproj index 5bd23b2e..b5e501f7 100644 --- a/Bloxstrap/Bloxstrap.csproj +++ b/Bloxstrap/Bloxstrap.csproj @@ -17,6 +17,7 @@ + diff --git a/Bloxstrap/Resources/Menu/StartMenuLocation.png b/Bloxstrap/Resources/Menu/StartMenuLocation.png new file mode 100644 index 00000000..208e68d0 Binary files /dev/null and b/Bloxstrap/Resources/Menu/StartMenuLocation.png differ diff --git a/Bloxstrap/UI/Elements/Menu/MainWindow.xaml b/Bloxstrap/UI/Elements/Menu/MainWindow.xaml index 24959214..273635f6 100644 --- a/Bloxstrap/UI/Elements/Menu/MainWindow.xaml +++ b/Bloxstrap/UI/Elements/Menu/MainWindow.xaml @@ -33,7 +33,7 @@ - + @@ -42,6 +42,8 @@ + + @@ -68,7 +70,7 @@ - + diff --git a/Bloxstrap/UI/Elements/Menu/Pages/PreInstallPage.xaml b/Bloxstrap/UI/Elements/Menu/Pages/PreInstallPage.xaml new file mode 100644 index 00000000..6b174dad --- /dev/null +++ b/Bloxstrap/UI/Elements/Menu/Pages/PreInstallPage.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Bloxstrap/UI/Elements/Menu/Pages/PreInstallPage.xaml.cs b/Bloxstrap/UI/Elements/Menu/Pages/PreInstallPage.xaml.cs new file mode 100644 index 00000000..04793ef7 --- /dev/null +++ b/Bloxstrap/UI/Elements/Menu/Pages/PreInstallPage.xaml.cs @@ -0,0 +1,13 @@ +namespace Bloxstrap.UI.Menu.Pages +{ + /// + /// Interaction logic for PreInstallPage.xaml + /// + public partial class PreInstallPage + { + public PreInstallPage() + { + InitializeComponent(); + } + } +} diff --git a/Bloxstrap/UI/ViewModels/Menu/MainWindowViewModel.cs b/Bloxstrap/UI/ViewModels/Menu/MainWindowViewModel.cs index 2a239a43..91c88f54 100644 --- a/Bloxstrap/UI/ViewModels/Menu/MainWindowViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Menu/MainWindowViewModel.cs @@ -1,5 +1,8 @@ using System; +using System.ComponentModel; using System.IO; +using System.Linq; +using System.Threading.Tasks; using System.Windows; using System.Windows.Input; @@ -7,15 +10,17 @@ using CommunityToolkit.Mvvm.Input; -using Wpf.Ui.Controls.Interfaces; using Wpf.Ui.Mvvm.Contracts; -using System.Linq; +using Bloxstrap.UI.Menu.Pages; namespace Bloxstrap.UI.ViewModels.Menu { - public class MainWindowViewModel + public class MainWindowViewModel : INotifyPropertyChanged { + public event PropertyChangedEventHandler? PropertyChanged; + public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + private readonly Window _window; private readonly IDialogService _dialogService; private readonly string _originalBaseDirectory = App.BaseDirectory; // we need this to check if the basedirectory changes @@ -23,7 +28,9 @@ public class MainWindowViewModel public ICommand CloseWindowCommand => new RelayCommand(CloseWindow); public ICommand ConfirmSettingsCommand => new RelayCommand(ConfirmSettings); + public Visibility NavigationVisibility { get; set; } = Visibility.Visible; public string ConfirmButtonText => App.IsFirstRun ? "Install" : "Save"; + public bool ConfirmButtonEnabled { get; set; } = true; public MainWindowViewModel(Window window, IDialogService dialogService) { @@ -90,7 +97,32 @@ private void ConfirmSettings() } } - if (!App.IsFirstRun) + if (App.IsFirstRun) + { + if (NavigationVisibility == Visibility.Visible) + { + ((INavigationWindow)_window).Navigate(typeof(PreInstallPage)); + + NavigationVisibility = Visibility.Collapsed; + ConfirmButtonEnabled = false; + + OnPropertyChanged(nameof(NavigationVisibility)); + OnPropertyChanged(nameof(ConfirmButtonEnabled)); + + Task.Run(async delegate + { + await Task.Delay(3000); + ConfirmButtonEnabled = true; + OnPropertyChanged(nameof(ConfirmButtonEnabled)); + }); + } + else + { + App.IsSetupComplete = true; + CloseWindow(); + } + } + else { App.ShouldSaveConfigs = true; App.FastFlags.Save(); @@ -112,23 +144,6 @@ private void ConfirmSettings() CloseWindow(); } - else - { - IDialogControl dialogControl = _dialogService.GetDialogControl(); - - dialogControl.ButtonRightClick += (_, _) => - { - dialogControl.Hide(); - App.IsSetupComplete = true; - CloseWindow(); - }; - - dialogControl.ShowAndWaitAsync( - "What to know before you install", - "After installation, you can open this 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." - ); - } } } }