diff --git a/Bloxstrap/Dialogs/BootstrapperDialogForm.cs b/Bloxstrap/Dialogs/BootstrapperDialogForm.cs index f0bf3ae..aad5cc6 100644 --- a/Bloxstrap/Dialogs/BootstrapperDialogForm.cs +++ b/Bloxstrap/Dialogs/BootstrapperDialogForm.cs @@ -81,7 +81,7 @@ namespace Bloxstrap.Dialogs public void SetupDialog() { - this.Text = App.ProjectName; + this.Text = App.Settings.Prop.BootstrapperTitle; this.Icon = App.Settings.Prop.BootstrapperIcon.GetIcon(); } diff --git a/Bloxstrap/Dialogs/FluentDialog.xaml b/Bloxstrap/Dialogs/FluentDialog.xaml index cfd310e..fad49b8 100644 --- a/Bloxstrap/Dialogs/FluentDialog.xaml +++ b/Bloxstrap/Dialogs/FluentDialog.xaml @@ -17,7 +17,7 @@ WindowCornerPreference="Round" WindowStartupLocation="CenterScreen"> - + diff --git a/Bloxstrap/Dialogs/FluentDialog.xaml.cs b/Bloxstrap/Dialogs/FluentDialog.xaml.cs index 1c31415..a9130ef 100644 --- a/Bloxstrap/Dialogs/FluentDialog.xaml.cs +++ b/Bloxstrap/Dialogs/FluentDialog.xaml.cs @@ -69,7 +69,7 @@ namespace Bloxstrap.Dialogs { _viewModel = new FluentDialogViewModel(this); DataContext = _viewModel; - Title = App.ProjectName; + Title = App.Settings.Prop.BootstrapperTitle; Icon = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource(); _themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light); diff --git a/Bloxstrap/Dialogs/VistaDialog.cs b/Bloxstrap/Dialogs/VistaDialog.cs index 589ad79..8d9211f 100644 --- a/Bloxstrap/Dialogs/VistaDialog.cs +++ b/Bloxstrap/Dialogs/VistaDialog.cs @@ -63,7 +63,7 @@ namespace Bloxstrap.Dialogs _dialogPage = new TaskDialogPage() { Icon = new TaskDialogIcon(App.Settings.Prop.BootstrapperIcon.GetIcon()), - Caption = App.ProjectName, + Caption = App.Settings.Prop.BootstrapperTitle, Buttons = { TaskDialogButton.Cancel }, ProgressBar = new TaskDialogProgressBar() @@ -91,7 +91,7 @@ namespace Bloxstrap.Dialogs TaskDialogPage successDialog = new() { Icon = TaskDialogIcon.ShieldSuccessGreenBar, - Caption = App.ProjectName, + Caption = App.Settings.Prop.BootstrapperTitle, Heading = message, Buttons = { TaskDialogButton.OK } }; @@ -114,7 +114,7 @@ namespace Bloxstrap.Dialogs TaskDialogPage errorDialog = new() { Icon = TaskDialogIcon.Error, - Caption = App.ProjectName, + Caption = App.Settings.Prop.BootstrapperTitle, Heading = "An error occurred while starting Roblox", Buttons = { TaskDialogButton.Close }, Expander = new TaskDialogExpander() diff --git a/Bloxstrap/Enums/BootstrapperIcon.cs b/Bloxstrap/Enums/BootstrapperIcon.cs index 2db24c7..d0b938e 100644 --- a/Bloxstrap/Enums/BootstrapperIcon.cs +++ b/Bloxstrap/Enums/BootstrapperIcon.cs @@ -1,4 +1,5 @@ -using System.Drawing; +using System; +using System.Drawing; using System.IO; using System.Windows.Media; using System.Windows.Media.Imaging; @@ -14,7 +15,8 @@ namespace Bloxstrap.Enums IconLate2015, Icon2017, Icon2019, - Icon2022 + Icon2022, + IconCustom } public static class BootstrapperIconEx @@ -25,6 +27,23 @@ namespace Bloxstrap.Enums public static Icon GetIcon(this BootstrapperIcon icon) { + // load the custom icon file + if (icon == BootstrapperIcon.IconCustom) + { + Icon? customIcon = null; + + try + { + customIcon = new Icon(App.Settings.Prop.BootstrapperIconCustomLocation); + } + catch (Exception ex) + { + App.Logger.WriteLine($"[BootstrapperIconEx::GetIcon] Failed to load custom icon! {ex}"); + } + + return customIcon ?? Properties.Resources.IconBloxstrap; + } + return icon switch { BootstrapperIcon.IconBloxstrap => Properties.Resources.IconBloxstrap, diff --git a/Bloxstrap/Models/Settings.cs b/Bloxstrap/Models/Settings.cs index 2b2b04f..bb88641 100644 --- a/Bloxstrap/Models/Settings.cs +++ b/Bloxstrap/Models/Settings.cs @@ -11,6 +11,8 @@ namespace Bloxstrap.Models // bloxstrap configuration public BootstrapperStyle BootstrapperStyle { get; set; } = BootstrapperStyle.FluentDialog; public BootstrapperIcon BootstrapperIcon { get; set; } = BootstrapperIcon.IconBloxstrap; + public string BootstrapperTitle { get; set; } = App.ProjectName; + public string BootstrapperIconCustomLocation { get; set; } = ""; public Theme Theme { get; set; } = Theme.Default; public bool CheckForUpdates { get; set; } = true; public bool CreateDesktopIcon { get; set; } = true; diff --git a/Bloxstrap/ViewModels/AppearanceViewModel.cs b/Bloxstrap/ViewModels/AppearanceViewModel.cs index 278f928..320a9c8 100644 --- a/Bloxstrap/ViewModels/AppearanceViewModel.cs +++ b/Bloxstrap/ViewModels/AppearanceViewModel.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.Linq; using System.Windows; using System.Windows.Controls; +using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media; using CommunityToolkit.Mvvm.Input; @@ -22,6 +23,7 @@ namespace Bloxstrap.ViewModels private readonly Page _page; public ICommand PreviewBootstrapperCommand => new RelayCommand(PreviewBootstrapper); + public ICommand BrowseCustomIconLocationCommand => new RelayCommand(BrowseCustomIconLocation); private void PreviewBootstrapper() { @@ -31,6 +33,18 @@ namespace Bloxstrap.ViewModels dialog.ShowBootstrapper(); } + private void BrowseCustomIconLocation() + { + using var dialog = new OpenFileDialog(); + dialog.Filter = "Icon files (*.ico)|*.ico|All files (*.*)|*.*"; + + if (dialog.ShowDialog() == DialogResult.OK) + { + CustomIconLocation = dialog.FileName; + OnPropertyChanged(nameof(CustomIconLocation)); + } + } + public AppearanceViewModel(Page page) { _page = page; @@ -78,6 +92,7 @@ namespace Bloxstrap.ViewModels { "Early 2015", BootstrapperIcon.IconEarly2015 }, { "2011", BootstrapperIcon.Icon2011 }, { "2009", BootstrapperIcon.Icon2009 }, + { "Custom", BootstrapperIcon.IconCustom }, }; public string Icon @@ -91,5 +106,21 @@ namespace Bloxstrap.ViewModels } public ImageSource IconPreviewSource => App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource(); + + public string Title + { + get => App.Settings.Prop.BootstrapperTitle; + set => App.Settings.Prop.BootstrapperTitle = value; + } + + public string CustomIconLocation + { + get => App.Settings.Prop.BootstrapperIconCustomLocation; + set + { + App.Settings.Prop.BootstrapperIconCustomLocation = value; + OnPropertyChanged(nameof(IconPreviewSource)); + } + } } } diff --git a/Bloxstrap/ViewModels/FluentDialogViewModel.cs b/Bloxstrap/ViewModels/FluentDialogViewModel.cs index 2b639a6..8429d97 100644 --- a/Bloxstrap/ViewModels/FluentDialogViewModel.cs +++ b/Bloxstrap/ViewModels/FluentDialogViewModel.cs @@ -22,6 +22,7 @@ namespace Bloxstrap.ViewModels public ICommand CancelInstallCommand => new RelayCommand(CancelInstall); + public string Title => App.Settings.Prop.BootstrapperTitle; public ImageSource Icon { get; set; } = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource(); public string Message { get; set; } = "Please wait..."; public bool ProgressIndeterminate { get; set; } = true; diff --git a/Bloxstrap/Views/Pages/AppearancePage.xaml b/Bloxstrap/Views/Pages/AppearancePage.xaml index bfa9651..a2cb776 100644 --- a/Bloxstrap/Views/Pages/AppearancePage.xaml +++ b/Bloxstrap/Views/Pages/AppearancePage.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Bloxstrap.Views.Pages" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800" + d:DesignHeight="520" d:DesignWidth="800" Title="AppearancePage" Scrollable="True"> @@ -50,6 +50,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +