From 8552d94a4ad7111305beff232db2aaf4d51dcb4e Mon Sep 17 00:00:00 2001 From: pizzaboxer <41478239+pizzaboxer@users.noreply.github.com> Date: Fri, 3 Feb 2023 17:37:10 +0000 Subject: [PATCH] Add backend code for new menu --- Bloxstrap/App.xaml.cs | 22 ++-- Bloxstrap/Bloxstrap.csproj | 1 + Bloxstrap/Bootstrapper.cs | 6 + .../BootstrapperDialogForm.cs | 4 +- Bloxstrap/Models/DeployInfo.cs | 15 +++ Bloxstrap/ViewModels/AboutViewModel.cs | 21 ++++ Bloxstrap/ViewModels/BootstrapperViewModel.cs | 91 +++++++++++++++ Bloxstrap/ViewModels/InstallationViewModel.cs | 108 ++++++++++++++++++ Bloxstrap/ViewModels/IntegrationsViewModel.cs | 95 +++++++++++++++ Bloxstrap/ViewModels/MainWindowViewModel.cs | 96 ++++++++++++++++ Bloxstrap/ViewModels/ModsViewModel.cs | 37 ++++++ Bloxstrap/Views/MainWindow.xaml | 18 +-- Bloxstrap/Views/MainWindow.xaml.cs | 18 +++ Bloxstrap/Views/Pages/AboutPage.xaml | 45 +++++--- Bloxstrap/Views/Pages/AboutPage.xaml.cs | 23 +--- Bloxstrap/Views/Pages/BootstrapperPage.xaml | 13 ++- .../Views/Pages/BootstrapperPage.xaml.cs | 5 +- Bloxstrap/Views/Pages/InstallationPage.xaml | 49 ++++++-- .../Views/Pages/InstallationPage.xaml.cs | 5 +- Bloxstrap/Views/Pages/IntegrationsPage.xaml | 89 +++++++++------ .../Views/Pages/IntegrationsPage.xaml.cs | 13 +-- Bloxstrap/Views/Pages/ModsPage.xaml | 41 +++++-- Bloxstrap/Views/Pages/ModsPage.xaml.cs | 5 +- Bloxstrap/Views/Pages/ReShadeHelpPage.xaml | 6 +- Bloxstrap/app.manifest | 79 +++++++++++++ 25 files changed, 770 insertions(+), 135 deletions(-) create mode 100644 Bloxstrap/Models/DeployInfo.cs create mode 100644 Bloxstrap/ViewModels/AboutViewModel.cs create mode 100644 Bloxstrap/ViewModels/BootstrapperViewModel.cs create mode 100644 Bloxstrap/ViewModels/InstallationViewModel.cs create mode 100644 Bloxstrap/ViewModels/IntegrationsViewModel.cs create mode 100644 Bloxstrap/ViewModels/MainWindowViewModel.cs create mode 100644 Bloxstrap/ViewModels/ModsViewModel.cs create mode 100644 Bloxstrap/app.manifest diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index 5b9559a..1988186 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -21,13 +21,13 @@ namespace Bloxstrap /// public partial class App : Application { - public const StringComparison StringFormat = StringComparison.InvariantCulture; public static readonly CultureInfo CultureFormat = CultureInfo.InvariantCulture; public const string ProjectName = "Bloxstrap"; public const string ProjectRepository = "pizzaboxer/bloxstrap"; public static string BaseDirectory = null!; + public static bool IsSetupComplete { get; set; } = true; public static bool IsFirstRun { get; private set; } = false; public static bool IsQuiet { get; private set; } = false; public static bool IsUninstall { get; private set; } = false; @@ -65,9 +65,6 @@ namespace Bloxstrap // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - new MainWindow().ShowDialog(); - return; - LaunchArgs = e.Args; HttpClient.Timeout = TimeSpan.FromMinutes(5); @@ -95,12 +92,13 @@ namespace Bloxstrap { IsFirstRun = true; Settings = SettingsManager.Settings; + BaseDirectory = Path.Combine(Directories.LocalAppData, ProjectName); - if (IsQuiet) - BaseDirectory = Path.Combine(Directories.LocalAppData, ProjectName); - else - //new Preferences().ShowDialog(); + if (!IsQuiet) + { + IsSetupComplete = false; new MainWindow().ShowDialog(); + } } else { @@ -109,8 +107,7 @@ namespace Bloxstrap } // preferences dialog was closed, and so base directory was never set - // (this doesnt account for the registry value not existing but thats basically never gonna happen) - if (String.IsNullOrEmpty(BaseDirectory)) + if (!IsSetupComplete) return; Directories.Initialize(BaseDirectory); @@ -132,8 +129,7 @@ namespace Bloxstrap string commandLine = ""; -#if DEBUG - //new Preferences().ShowDialog(); +#if false//DEBUG new MainWindow().ShowDialog(); #else if (LaunchArgs.Length > 0) @@ -147,7 +143,7 @@ namespace Bloxstrap } //new Preferences().ShowDialog(); - new Configuration.MainWindow().ShowDialog(); + new MainWindow().ShowDialog(); } else if (LaunchArgs[0].StartsWith("roblox-player:")) { diff --git a/Bloxstrap/Bloxstrap.csproj b/Bloxstrap/Bloxstrap.csproj index b6cbd71..7a5330e 100644 --- a/Bloxstrap/Bloxstrap.csproj +++ b/Bloxstrap/Bloxstrap.csproj @@ -9,6 +9,7 @@ Bloxstrap.ico 2.0.0 2.0.0.0 + app.manifest diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 244c251..f52f4e3 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -449,6 +449,12 @@ namespace Bloxstrap private void UpdateProgressbar() { int newProgress = (int)Math.Floor(ProgressIncrement * TotalDownloadedBytes); + + // bugcheck: if we're restoring a file from a package, it'll incorrectly increment the progress beyond 100 + // too lazy to fix properly so lol + if (newProgress > 100) + return; + Dialog.ProgressValue = newProgress; } diff --git a/Bloxstrap/Dialogs/BootstrapperDialogs/BootstrapperDialogForm.cs b/Bloxstrap/Dialogs/BootstrapperDialogs/BootstrapperDialogForm.cs index fc60e59..98e958d 100644 --- a/Bloxstrap/Dialogs/BootstrapperDialogs/BootstrapperDialogForm.cs +++ b/Bloxstrap/Dialogs/BootstrapperDialogs/BootstrapperDialogForm.cs @@ -84,13 +84,13 @@ namespace Bloxstrap.Dialogs.BootstrapperDialogs if (Bootstrapper is null) { - Message = "Style Preview - Click Cancel to return"; + Message = "Style preview - Click Cancel to close"; CancelEnabled = true; } else { Bootstrapper.Dialog = this; - Task.Run(() => RunBootstrapper()); + Task.Run(RunBootstrapper); } } diff --git a/Bloxstrap/Models/DeployInfo.cs b/Bloxstrap/Models/DeployInfo.cs new file mode 100644 index 0000000..2f8f265 --- /dev/null +++ b/Bloxstrap/Models/DeployInfo.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Bloxstrap.Models +{ + public class DeployInfo + { + public string Timestamp { get; set; } = null!; + public string Version { get; set; } = null!; + public string VersionGuid { get; set; } = null!; + } +} diff --git a/Bloxstrap/ViewModels/AboutViewModel.cs b/Bloxstrap/ViewModels/AboutViewModel.cs new file mode 100644 index 0000000..229d056 --- /dev/null +++ b/Bloxstrap/ViewModels/AboutViewModel.cs @@ -0,0 +1,21 @@ +using System.Windows.Input; +using CommunityToolkit.Mvvm.Input; +using Bloxstrap.Helpers; + +namespace Bloxstrap.ViewModels +{ + public class AboutViewModel + { + public ICommand OpenWebpageCommand => new RelayCommand(OpenWebpage); + + private void OpenWebpage(string? location) + { + if (location is null) + return; + + Utilities.OpenWebsite(location); + } + + public string Version => $"Version {App.Version}"; + } +} diff --git a/Bloxstrap/ViewModels/BootstrapperViewModel.cs b/Bloxstrap/ViewModels/BootstrapperViewModel.cs new file mode 100644 index 0000000..5d77c0d --- /dev/null +++ b/Bloxstrap/ViewModels/BootstrapperViewModel.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using Bloxstrap.Enums; +using Bloxstrap.Views; +using CommunityToolkit.Mvvm.Input; +using Wpf.Ui.Mvvm.Services; +using Wpf.Ui.Mvvm.Contracts; + +namespace Bloxstrap.ViewModels +{ + public class BootstrapperViewModel + { + private readonly Page _page; + + public ICommand PreviewBootstrapperCommand => new RelayCommand(PreviewBootstrapper); + + private void PreviewBootstrapper() => App.Settings.BootstrapperStyle.Show(); + + public BootstrapperViewModel(Page page) + { + _page = page; + } + + public bool UpdateCheckingEnabled + { + get => App.Settings.CheckForUpdates; + set => App.Settings.CheckForUpdates = value; + } + + public bool ChannelChangePromptingEnabled + { + get => App.Settings.PromptChannelChange; + set => App.Settings.PromptChannelChange = value; + } + + public IReadOnlyDictionary Themes { get; set; } = new Dictionary() + { + { "System Default", Enums.Theme.Default }, + { "Light", Enums.Theme.Light }, + { "Dark", Enums.Theme.Dark }, + }; + + public string Theme + { + get => Themes.FirstOrDefault(x => x.Value == App.Settings.Theme).Key; + set + { + App.Settings.Theme = Themes[value]; + ((MainWindow)Window.GetWindow(_page)!).SetTheme(); + } + } + + public IReadOnlyDictionary Dialogs { get; set; } = new Dictionary() + { + { "Vista (2009 - 2011)", BootstrapperStyle.VistaDialog }, + { "Legacy (2009 - 2011)", BootstrapperStyle.LegacyDialog2009 }, + { "Legacy (2011 - 2014)", BootstrapperStyle.LegacyDialog2011 }, + { "Progress (~2014)", BootstrapperStyle.ProgressDialog }, + }; + + public string Dialog + { + get => Dialogs.FirstOrDefault(x => x.Value == App.Settings.BootstrapperStyle).Key; + set => App.Settings.BootstrapperStyle = Dialogs[value]; + } + + public IReadOnlyDictionary Icons { get; set; } = new Dictionary() + { + { "Bloxstrap", BootstrapperIcon.IconBloxstrap }, + { "2009", BootstrapperIcon.Icon2009 }, + { "2011", BootstrapperIcon.Icon2011 }, + { "2015", BootstrapperIcon.IconEarly2015 }, + { "2016", BootstrapperIcon.IconLate2015 }, + { "2017", BootstrapperIcon.Icon2017 }, + { "2019", BootstrapperIcon.Icon2019 }, + { "2022", BootstrapperIcon.Icon2022 } + }; + + public string Icon + { + get => Icons.FirstOrDefault(x => x.Value == App.Settings.BootstrapperIcon).Key; + set => App.Settings.BootstrapperIcon = Icons[value]; + } + } +} diff --git a/Bloxstrap/ViewModels/InstallationViewModel.cs b/Bloxstrap/ViewModels/InstallationViewModel.cs new file mode 100644 index 0000000..5fab280 --- /dev/null +++ b/Bloxstrap/ViewModels/InstallationViewModel.cs @@ -0,0 +1,108 @@ +using Bloxstrap.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; +using CommunityToolkit.Mvvm.Input; +using System.Windows.Forms; +using Wpf.Ui.Mvvm.Interfaces; +using System.ComponentModel; +using Bloxstrap.Helpers; +using Bloxstrap.Models; + +namespace Bloxstrap.ViewModels +{ + public class InstallationViewModel : INotifyPropertyChanged + { + public event PropertyChangedEventHandler? PropertyChanged; + public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + + private IEnumerable _channels = DeployManager.ChannelsAbstracted.Contains(App.Settings.Channel) ? DeployManager.ChannelsAbstracted : DeployManager.ChannelsAll; + private bool _showAllChannels = !DeployManager.ChannelsAbstracted.Contains(App.Settings.Channel); + + public ICommand BrowseInstallLocationCommand => new RelayCommand(BrowseInstallLocation); + + public DeployInfo? ChannelDeployInfo { get; private set; } = null; //new DeployInfo(){ Version = "hi", VersionGuid = "hi", Timestamp = "January 25 2023 at 6:03:48 PM" }; + + public InstallationViewModel() + { + Task.Run(() => LoadChannelDeployInfo(App.Settings.Channel)); + } + + private async Task LoadChannelDeployInfo(string channel) + { + ChannelDeployInfo = null; + OnPropertyChanged(nameof(ChannelDeployInfo)); + + ClientVersion info = await DeployManager.GetLastDeploy(channel, true); + string? strTimestamp = info.Timestamp?.ToString("MM/dd/yyyy h:mm:ss tt", App.CultureFormat); + + ChannelDeployInfo = new DeployInfo() { Version = info.Version, VersionGuid = info.VersionGuid, Timestamp = strTimestamp! }; + OnPropertyChanged(nameof(ChannelDeployInfo)); + } + + private void BrowseInstallLocation() + { + using var dialog = new FolderBrowserDialog(); + + if (dialog.ShowDialog() == DialogResult.OK) + { + InstallLocation = dialog.SelectedPath; + OnPropertyChanged(nameof(InstallLocation)); + } + } + + public string InstallLocation + { + get => App.BaseDirectory; + set => App.BaseDirectory = value; + } + + public bool CreateDesktopIcon + { + get => App.Settings.CreateDesktopIcon; + set => App.Settings.CreateDesktopIcon = value; + } + + public IEnumerable Channels + { + get => _channels; + set => _channels = value; + } + + public string Channel + { + get => App.Settings.Channel; + set + { + //Task.Run(() => GetChannelInfo(value)); + Task.Run(() => LoadChannelDeployInfo(value)); + App.Settings.Channel = value; + } + } + + public bool ShowAllChannels + { + get => _showAllChannels; + set + { + if (value) + { + Channels = DeployManager.ChannelsAll; + } + else + { + Channels = DeployManager.ChannelsAbstracted; + Channel = DeployManager.DefaultChannel; + OnPropertyChanged(nameof(Channel)); + } + + OnPropertyChanged(nameof(Channels)); + + _showAllChannels = value; + } + } + } +} diff --git a/Bloxstrap/ViewModels/IntegrationsViewModel.cs b/Bloxstrap/ViewModels/IntegrationsViewModel.cs new file mode 100644 index 0000000..e30dae2 --- /dev/null +++ b/Bloxstrap/ViewModels/IntegrationsViewModel.cs @@ -0,0 +1,95 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using Wpf.Ui.Mvvm.Contracts; +using Bloxstrap.Views.Pages; +using Bloxstrap.Helpers; +using System.Diagnostics; + +namespace Bloxstrap.ViewModels +{ + public class IntegrationsViewModel : INotifyPropertyChanged + { + public event PropertyChangedEventHandler? PropertyChanged; + public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + + private readonly Page _page; + + public ICommand OpenReShadeFolderCommand => new RelayCommand(OpenReShadeFolder); + public ICommand ShowReShadeHelpCommand => new RelayCommand(ShowReShadeHelp); + + public bool CanOpenReShadeFolder => !App.IsFirstRun; + + public IntegrationsViewModel(Page page) + { + _page = page; + } + + private void OpenReShadeFolder() + { + Process.Start("explorer.exe", Directories.ReShade); + } + + private void ShowReShadeHelp() + { + ((INavigationWindow)Window.GetWindow(_page)!).Navigate(typeof(ReShadeHelpPage)); + } + + public bool DiscordActivityEnabled + { + get => App.Settings.UseDiscordRichPresence; + set + { + App.Settings.UseDiscordRichPresence = value; + + if (!value) + { + DiscordActivityJoinEnabled = value; + OnPropertyChanged(nameof(DiscordActivityJoinEnabled)); + } + } + } + + public bool DiscordActivityJoinEnabled + { + get => !App.Settings.HideRPCButtons; + set => App.Settings.HideRPCButtons = !value; + } + + public bool ReShadeEnabled + { + get => App.Settings.UseReShade; + set + { + App.Settings.UseReShade = value; + ReShadePresetsEnabled = value; + OnPropertyChanged(nameof(ReShadePresetsEnabled)); + } + } + + public bool ReShadePresetsEnabled + { + get => App.Settings.UseReShadeExtraviPresets; + set => App.Settings.UseReShadeExtraviPresets = value; + } + + public bool RbxFpsUnlockerEnabled + { + get => App.Settings.RFUEnabled; + set + { + App.Settings.RFUEnabled = value; + RbxFpsUnlockerAutocloseEnabled = value; + OnPropertyChanged(nameof(RbxFpsUnlockerAutocloseEnabled)); + } + } + + public bool RbxFpsUnlockerAutocloseEnabled + { + get => App.Settings.RFUAutoclose; + set => App.Settings.RFUAutoclose = value; + } + } +} diff --git a/Bloxstrap/ViewModels/MainWindowViewModel.cs b/Bloxstrap/ViewModels/MainWindowViewModel.cs new file mode 100644 index 0000000..508082d --- /dev/null +++ b/Bloxstrap/ViewModels/MainWindowViewModel.cs @@ -0,0 +1,96 @@ +using System.IO; +using System; +using System.Windows; +using System.Windows.Automation.Peers; +using System.Windows.Input; +using Bloxstrap.Views; +using CommunityToolkit.Mvvm.Input; +using Microsoft.Win32; + +namespace Bloxstrap.ViewModels +{ + public class MainWindowViewModel + { + private readonly Window _window; + private readonly string _originalBaseDirectory = App.BaseDirectory; // we need this to check if the basedirectory changes + + public ICommand CloseWindowCommand => new RelayCommand(CloseWindow); + public ICommand ConfirmSettingsCommand => new RelayCommand(ConfirmSettings); + + public string ConfirmButtonText => App.IsFirstRun ? "Install" : "Save"; + + public MainWindowViewModel(Window window) + { + _window = window; + } + + private void CloseWindow() => _window.Close(); + + private void ConfirmSettings() + { + if (String.IsNullOrEmpty(App.BaseDirectory)) + { + App.ShowMessageBox("You must set an install location", MessageBoxImage.Error); + return; + } + + try + { + // check if we can write to the directory (a bit hacky but eh) + + string testPath = App.BaseDirectory; + string testFile = Path.Combine(testPath, $"{App.ProjectName}WriteTest.txt"); + bool testPathExists = Directory.Exists(testPath); + + if (!testPathExists) + Directory.CreateDirectory(testPath); + + File.WriteAllText(testFile, "hi"); + File.Delete(testFile); + + if (!testPathExists) + Directory.Delete(testPath); + } + catch (UnauthorizedAccessException) + { + App.ShowMessageBox($"{App.ProjectName} does not have write access to the install location you selected. Please choose another install location.", MessageBoxImage.Error); + return; + } + catch (Exception ex) + { + App.ShowMessageBox(ex.Message, MessageBoxImage.Error); + return; + } + + if (!App.IsFirstRun) + { + App.SettingsManager.ShouldSave = true; + + if (App.BaseDirectory != _originalBaseDirectory) + { + App.ShowMessageBox($"{App.ProjectName} will install to the new location you've set the next time it runs.", MessageBoxImage.Information); + + App.Settings.VersionGuid = ""; + + using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey($@"Software\{App.ProjectName}")) + { + registryKey.SetValue("InstallLocation", App.BaseDirectory); + registryKey.SetValue("OldInstallLocation", _originalBaseDirectory); + registryKey.Close(); + } + + // preserve settings + // we don't need to copy the bootstrapper over since the install process will do that automatically + + App.SettingsManager.Save(); + + File.Copy(Path.Combine(App.BaseDirectory, "Settings.json"), Path.Combine(App.BaseDirectory, "Settings.json")); + } + } + + App.IsSetupComplete = true; + + CloseWindow(); + } + } +} diff --git a/Bloxstrap/ViewModels/ModsViewModel.cs b/Bloxstrap/ViewModels/ModsViewModel.cs new file mode 100644 index 0000000..99ce853 --- /dev/null +++ b/Bloxstrap/ViewModels/ModsViewModel.cs @@ -0,0 +1,37 @@ +using System.Diagnostics; +using System.Windows.Input; +using Bloxstrap.Helpers; +using CommunityToolkit.Mvvm.Input; + +namespace Bloxstrap.ViewModels +{ + public class ModsViewModel + { + public ICommand OpenModsFolderCommand => new RelayCommand(OpenModsFolder); + + public bool CanOpenModsFolder => !App.IsFirstRun; + + private void OpenModsFolder() + { + Process.Start("explorer.exe", Directories.Modifications); + } + + public bool OldDeathSoundEnabled + { + get => App.Settings.UseOldDeathSound; + set => App.Settings.UseOldDeathSound = value; + } + + public bool OldMouseCursorEnabled + { + get => App.Settings.UseOldMouseCursor; + set => App.Settings.UseOldMouseCursor = value; + } + + public bool DisableAppPatchEnabled + { + get => App.Settings.UseDisableAppPatch; + set => App.Settings.UseDisableAppPatch = value; + } + } +} diff --git a/Bloxstrap/Views/MainWindow.xaml b/Bloxstrap/Views/MainWindow.xaml index 2d6ce86..d401a8f 100644 --- a/Bloxstrap/Views/MainWindow.xaml +++ b/Bloxstrap/Views/MainWindow.xaml @@ -1,12 +1,14 @@  - + - + @@ -37,7 +39,7 @@ - + @@ -89,10 +91,10 @@ - + - + diff --git a/Bloxstrap/Views/MainWindow.xaml.cs b/Bloxstrap/Views/MainWindow.xaml.cs index d8d5298..69c4b87 100644 --- a/Bloxstrap/Views/MainWindow.xaml.cs +++ b/Bloxstrap/Views/MainWindow.xaml.cs @@ -2,7 +2,10 @@ using System; using Wpf.Ui.Controls.Interfaces; using Wpf.Ui.Mvvm.Contracts; +using Bloxstrap.Enums; +using Bloxstrap.ViewModels; using Wpf.Ui.Mvvm.Services; +using Wpf.Ui.Appearance; namespace Bloxstrap.Views { @@ -11,11 +14,26 @@ namespace Bloxstrap.Views /// public partial class MainWindow : INavigationWindow { + private readonly IThemeService _themeService = new ThemeService(); + public MainWindow() { + DataContext = new MainWindowViewModel(this); + SetTheme(); InitializeComponent(); } + public void SetTheme() + { + var theme = ThemeType.Light; + + if (App.Settings.Theme.GetFinal() == Enums.Theme.Dark) + theme = ThemeType.Dark; + + _themeService.SetTheme(theme); + _themeService.SetSystemAccent(); + } + #region INavigationWindow methods public Frame GetFrame() => RootFrame; diff --git a/Bloxstrap/Views/Pages/AboutPage.xaml b/Bloxstrap/Views/Pages/AboutPage.xaml index 655960f..f441246 100644 --- a/Bloxstrap/Views/Pages/AboutPage.xaml +++ b/Bloxstrap/Views/Pages/AboutPage.xaml @@ -28,14 +28,18 @@ - + - + + + + + + - @@ -43,22 +47,26 @@ + - + Multako - + bluepilledgreat - - + 1011025m + + + sitiom + - + @@ -76,52 +84,51 @@ - + - + - + - + - + - - + - + - + - + diff --git a/Bloxstrap/Views/Pages/AboutPage.xaml.cs b/Bloxstrap/Views/Pages/AboutPage.xaml.cs index 152d950..1d3cbdb 100644 --- a/Bloxstrap/Views/Pages/AboutPage.xaml.cs +++ b/Bloxstrap/Views/Pages/AboutPage.xaml.cs @@ -1,10 +1,4 @@ -using System.Diagnostics; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Input; -using Bloxstrap.Helpers; -using CommunityToolkit.Mvvm.Input; -using static System.Net.Mime.MediaTypeNames; +using Bloxstrap.ViewModels; namespace Bloxstrap.Views.Pages { @@ -15,21 +9,8 @@ namespace Bloxstrap.Views.Pages { public AboutPage() { - DataContext = new AboutPageViewModel(); + DataContext = new AboutViewModel(); InitializeComponent(); } } - - public class AboutPageViewModel - { - public ICommand OpenWebpageCommand => new RelayCommand(OpenWebpage); - - private void OpenWebpage(string? location) - { - if (location is null) - return; - - Utilities.OpenWebsite(location); - } - } } diff --git a/Bloxstrap/Views/Pages/BootstrapperPage.xaml b/Bloxstrap/Views/Pages/BootstrapperPage.xaml index 69bb640..177ed9a 100644 --- a/Bloxstrap/Views/Pages/BootstrapperPage.xaml +++ b/Bloxstrap/Views/Pages/BootstrapperPage.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:models="clr-namespace:Bloxstrap.ViewModels" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" @@ -20,7 +21,7 @@ - + @@ -29,7 +30,7 @@ - + @@ -41,7 +42,7 @@ - + @@ -50,7 +51,7 @@ - + @@ -59,8 +60,8 @@ - + - + diff --git a/Bloxstrap/Views/Pages/BootstrapperPage.xaml.cs b/Bloxstrap/Views/Pages/BootstrapperPage.xaml.cs index 676b3b8..de46bac 100644 --- a/Bloxstrap/Views/Pages/BootstrapperPage.xaml.cs +++ b/Bloxstrap/Views/Pages/BootstrapperPage.xaml.cs @@ -1,4 +1,6 @@ -namespace Bloxstrap.Views.Pages +using Bloxstrap.ViewModels; + +namespace Bloxstrap.Views.Pages { /// /// Interaction logic for BootstrapperPage.xaml @@ -7,6 +9,7 @@ { public BootstrapperPage() { + DataContext = new BootstrapperViewModel(this); InitializeComponent(); } } diff --git a/Bloxstrap/Views/Pages/InstallationPage.xaml b/Bloxstrap/Views/Pages/InstallationPage.xaml index 4079dbd..e0118f7 100644 --- a/Bloxstrap/Views/Pages/InstallationPage.xaml +++ b/Bloxstrap/Views/Pages/InstallationPage.xaml @@ -10,7 +10,7 @@ Scrollable="True"> - + @@ -24,8 +24,8 @@ - - + + @@ -36,7 +36,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -60,6 +60,16 @@ + + + @@ -71,15 +81,34 @@ - + - - + + - + - + + + + + + + + + + + + + diff --git a/Bloxstrap/Views/Pages/InstallationPage.xaml.cs b/Bloxstrap/Views/Pages/InstallationPage.xaml.cs index b2de3a5..de97c47 100644 --- a/Bloxstrap/Views/Pages/InstallationPage.xaml.cs +++ b/Bloxstrap/Views/Pages/InstallationPage.xaml.cs @@ -1,4 +1,6 @@ -namespace Bloxstrap.Views.Pages +using Bloxstrap.ViewModels; + +namespace Bloxstrap.Views.Pages { /// /// Interaction logic for InstallationPage.xaml @@ -7,6 +9,7 @@ { public InstallationPage() { + DataContext = new InstallationViewModel(); InitializeComponent(); } } diff --git a/Bloxstrap/Views/Pages/IntegrationsPage.xaml b/Bloxstrap/Views/Pages/IntegrationsPage.xaml index a62b300..d353c2d 100644 --- a/Bloxstrap/Views/Pages/IntegrationsPage.xaml +++ b/Bloxstrap/Views/Pages/IntegrationsPage.xaml @@ -1,14 +1,15 @@  - @@ -20,16 +21,16 @@ - + - + - + @@ -40,54 +41,78 @@ - + - + - + - + - - + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/Bloxstrap/Views/Pages/IntegrationsPage.xaml.cs b/Bloxstrap/Views/Pages/IntegrationsPage.xaml.cs index 3633624..caf7cfb 100644 --- a/Bloxstrap/Views/Pages/IntegrationsPage.xaml.cs +++ b/Bloxstrap/Views/Pages/IntegrationsPage.xaml.cs @@ -1,9 +1,6 @@ using System; -using System.Diagnostics; using System.Windows; -using Wpf.Ui.Common.Interfaces; -using Wpf.Ui.Mvvm.Contracts; -using Wpf.Ui.Mvvm.Interfaces; +using Bloxstrap.ViewModels; namespace Bloxstrap.Views.Pages { @@ -14,12 +11,12 @@ namespace Bloxstrap.Views.Pages { public IntegrationsPage() { + DataContext = new IntegrationsViewModel(this); InitializeComponent(); - } - private void NavigateReShadeHelp(object sender, EventArgs e) - { - ((INavigationWindow)Window.GetWindow(this)!).Navigate(typeof(ReShadeHelpPage)); + // rbxfpsunlocker does not have 64 bit support + if (!Environment.Is64BitOperatingSystem) + this.RbxFpsUnlockerOptions.Visibility = Visibility.Collapsed; } } } diff --git a/Bloxstrap/Views/Pages/ModsPage.xaml b/Bloxstrap/Views/Pages/ModsPage.xaml index 81caa2b..f9eb393 100644 --- a/Bloxstrap/Views/Pages/ModsPage.xaml +++ b/Bloxstrap/Views/Pages/ModsPage.xaml @@ -3,19 +3,41 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:models="clr-namespace:Bloxstrap.ViewModels" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" Title="ModsPage" Scrollable="True"> - - + - - + + + + + + + + + + + @@ -34,31 +56,34 @@ + - + + - + + - + - + diff --git a/Bloxstrap/Views/Pages/ModsPage.xaml.cs b/Bloxstrap/Views/Pages/ModsPage.xaml.cs index 24d0dc7..73fc1ab 100644 --- a/Bloxstrap/Views/Pages/ModsPage.xaml.cs +++ b/Bloxstrap/Views/Pages/ModsPage.xaml.cs @@ -1,6 +1,4 @@ -using System; -using System.Windows; -using Wpf.Ui.Mvvm.Contracts; +using Bloxstrap.ViewModels; namespace Bloxstrap.Views.Pages { @@ -11,6 +9,7 @@ namespace Bloxstrap.Views.Pages { public ModsPage() { + DataContext = new ModsViewModel(); InitializeComponent(); } } diff --git a/Bloxstrap/Views/Pages/ReShadeHelpPage.xaml b/Bloxstrap/Views/Pages/ReShadeHelpPage.xaml index 0680f6e..d70aade 100644 --- a/Bloxstrap/Views/Pages/ReShadeHelpPage.xaml +++ b/Bloxstrap/Views/Pages/ReShadeHelpPage.xaml @@ -11,7 +11,7 @@ Scrollable="True"> - + @@ -36,9 +36,9 @@ - + - + diff --git a/Bloxstrap/app.manifest b/Bloxstrap/app.manifest new file mode 100644 index 0000000..897208d --- /dev/null +++ b/Bloxstrap/app.manifest @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +