mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 01:51:29 -07:00
Add extra bootstrapper customization (#94/#95)
Added support for customizing bootstrapper title and icon
This commit is contained in:
parent
b5250e29dc
commit
1e46aaa929
@ -81,7 +81,7 @@ namespace Bloxstrap.Dialogs
|
|||||||
|
|
||||||
public void SetupDialog()
|
public void SetupDialog()
|
||||||
{
|
{
|
||||||
this.Text = App.ProjectName;
|
this.Text = App.Settings.Prop.BootstrapperTitle;
|
||||||
this.Icon = App.Settings.Prop.BootstrapperIcon.GetIcon();
|
this.Icon = App.Settings.Prop.BootstrapperIcon.GetIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
WindowCornerPreference="Round"
|
WindowCornerPreference="Round"
|
||||||
WindowStartupLocation="CenterScreen">
|
WindowStartupLocation="CenterScreen">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<ui:TitleBar Background="{ui:ThemeResource ApplicationBackgroundBrush}" Padding="15,15,0,10" x:Name="RootTitleBar" Grid.Row="0" ForceShutdown="False" MinimizeToTray="False" ShowHelp="False" UseSnapLayout="False" ShowClose="False" ShowMinimize="False" ShowMaximize="False" Title="Bloxstrap" />
|
<ui:TitleBar Background="{ui:ThemeResource ApplicationBackgroundBrush}" Title="{Binding Title, Mode=OneTime}" Padding="15,15,0,10" x:Name="RootTitleBar" Grid.Row="0" ForceShutdown="False" MinimizeToTray="False" ShowHelp="False" UseSnapLayout="False" ShowClose="False" ShowMinimize="False" ShowMaximize="False" />
|
||||||
<Grid Margin="16,0,16,0">
|
<Grid Margin="16,0,16,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
|
@ -69,7 +69,7 @@ namespace Bloxstrap.Dialogs
|
|||||||
{
|
{
|
||||||
_viewModel = new FluentDialogViewModel(this);
|
_viewModel = new FluentDialogViewModel(this);
|
||||||
DataContext = _viewModel;
|
DataContext = _viewModel;
|
||||||
Title = App.ProjectName;
|
Title = App.Settings.Prop.BootstrapperTitle;
|
||||||
Icon = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();
|
Icon = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();
|
||||||
|
|
||||||
_themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light);
|
_themeService.SetTheme(App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Dark ? ThemeType.Dark : ThemeType.Light);
|
||||||
|
@ -63,7 +63,7 @@ namespace Bloxstrap.Dialogs
|
|||||||
_dialogPage = new TaskDialogPage()
|
_dialogPage = new TaskDialogPage()
|
||||||
{
|
{
|
||||||
Icon = new TaskDialogIcon(App.Settings.Prop.BootstrapperIcon.GetIcon()),
|
Icon = new TaskDialogIcon(App.Settings.Prop.BootstrapperIcon.GetIcon()),
|
||||||
Caption = App.ProjectName,
|
Caption = App.Settings.Prop.BootstrapperTitle,
|
||||||
|
|
||||||
Buttons = { TaskDialogButton.Cancel },
|
Buttons = { TaskDialogButton.Cancel },
|
||||||
ProgressBar = new TaskDialogProgressBar()
|
ProgressBar = new TaskDialogProgressBar()
|
||||||
@ -91,7 +91,7 @@ namespace Bloxstrap.Dialogs
|
|||||||
TaskDialogPage successDialog = new()
|
TaskDialogPage successDialog = new()
|
||||||
{
|
{
|
||||||
Icon = TaskDialogIcon.ShieldSuccessGreenBar,
|
Icon = TaskDialogIcon.ShieldSuccessGreenBar,
|
||||||
Caption = App.ProjectName,
|
Caption = App.Settings.Prop.BootstrapperTitle,
|
||||||
Heading = message,
|
Heading = message,
|
||||||
Buttons = { TaskDialogButton.OK }
|
Buttons = { TaskDialogButton.OK }
|
||||||
};
|
};
|
||||||
@ -114,7 +114,7 @@ namespace Bloxstrap.Dialogs
|
|||||||
TaskDialogPage errorDialog = new()
|
TaskDialogPage errorDialog = new()
|
||||||
{
|
{
|
||||||
Icon = TaskDialogIcon.Error,
|
Icon = TaskDialogIcon.Error,
|
||||||
Caption = App.ProjectName,
|
Caption = App.Settings.Prop.BootstrapperTitle,
|
||||||
Heading = "An error occurred while starting Roblox",
|
Heading = "An error occurred while starting Roblox",
|
||||||
Buttons = { TaskDialogButton.Close },
|
Buttons = { TaskDialogButton.Close },
|
||||||
Expander = new TaskDialogExpander()
|
Expander = new TaskDialogExpander()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Drawing;
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
@ -14,7 +15,8 @@ namespace Bloxstrap.Enums
|
|||||||
IconLate2015,
|
IconLate2015,
|
||||||
Icon2017,
|
Icon2017,
|
||||||
Icon2019,
|
Icon2019,
|
||||||
Icon2022
|
Icon2022,
|
||||||
|
IconCustom
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BootstrapperIconEx
|
public static class BootstrapperIconEx
|
||||||
@ -25,6 +27,23 @@ namespace Bloxstrap.Enums
|
|||||||
|
|
||||||
public static Icon GetIcon(this BootstrapperIcon icon)
|
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
|
return icon switch
|
||||||
{
|
{
|
||||||
BootstrapperIcon.IconBloxstrap => Properties.Resources.IconBloxstrap,
|
BootstrapperIcon.IconBloxstrap => Properties.Resources.IconBloxstrap,
|
||||||
|
@ -11,6 +11,8 @@ namespace Bloxstrap.Models
|
|||||||
// bloxstrap configuration
|
// bloxstrap configuration
|
||||||
public BootstrapperStyle BootstrapperStyle { get; set; } = BootstrapperStyle.FluentDialog;
|
public BootstrapperStyle BootstrapperStyle { get; set; } = BootstrapperStyle.FluentDialog;
|
||||||
public BootstrapperIcon BootstrapperIcon { get; set; } = BootstrapperIcon.IconBloxstrap;
|
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 Theme Theme { get; set; } = Theme.Default;
|
||||||
public bool CheckForUpdates { get; set; } = true;
|
public bool CheckForUpdates { get; set; } = true;
|
||||||
public bool CreateDesktopIcon { get; set; } = true;
|
public bool CreateDesktopIcon { get; set; } = true;
|
||||||
|
@ -3,6 +3,7 @@ using System.ComponentModel;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
@ -22,6 +23,7 @@ namespace Bloxstrap.ViewModels
|
|||||||
private readonly Page _page;
|
private readonly Page _page;
|
||||||
|
|
||||||
public ICommand PreviewBootstrapperCommand => new RelayCommand(PreviewBootstrapper);
|
public ICommand PreviewBootstrapperCommand => new RelayCommand(PreviewBootstrapper);
|
||||||
|
public ICommand BrowseCustomIconLocationCommand => new RelayCommand(BrowseCustomIconLocation);
|
||||||
|
|
||||||
private void PreviewBootstrapper()
|
private void PreviewBootstrapper()
|
||||||
{
|
{
|
||||||
@ -31,6 +33,18 @@ namespace Bloxstrap.ViewModels
|
|||||||
dialog.ShowBootstrapper();
|
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)
|
public AppearanceViewModel(Page page)
|
||||||
{
|
{
|
||||||
_page = page;
|
_page = page;
|
||||||
@ -78,6 +92,7 @@ namespace Bloxstrap.ViewModels
|
|||||||
{ "Early 2015", BootstrapperIcon.IconEarly2015 },
|
{ "Early 2015", BootstrapperIcon.IconEarly2015 },
|
||||||
{ "2011", BootstrapperIcon.Icon2011 },
|
{ "2011", BootstrapperIcon.Icon2011 },
|
||||||
{ "2009", BootstrapperIcon.Icon2009 },
|
{ "2009", BootstrapperIcon.Icon2009 },
|
||||||
|
{ "Custom", BootstrapperIcon.IconCustom },
|
||||||
};
|
};
|
||||||
|
|
||||||
public string Icon
|
public string Icon
|
||||||
@ -91,5 +106,21 @@ namespace Bloxstrap.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ImageSource IconPreviewSource => App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ namespace Bloxstrap.ViewModels
|
|||||||
|
|
||||||
public ICommand CancelInstallCommand => new RelayCommand(CancelInstall);
|
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 ImageSource Icon { get; set; } = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();
|
||||||
public string Message { get; set; } = "Please wait...";
|
public string Message { get; set; } = "Please wait...";
|
||||||
public bool ProgressIndeterminate { get; set; } = true;
|
public bool ProgressIndeterminate { get; set; } = true;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
xmlns:local="clr-namespace:Bloxstrap.Views.Pages"
|
xmlns:local="clr-namespace:Bloxstrap.Views.Pages"
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="520" d:DesignWidth="800"
|
||||||
Title="AppearancePage"
|
Title="AppearancePage"
|
||||||
Scrollable="True">
|
Scrollable="True">
|
||||||
<StackPanel Margin="0,0,14,14">
|
<StackPanel Margin="0,0,14,14">
|
||||||
@ -50,6 +50,46 @@
|
|||||||
<ComboBox Grid.Column="1" Margin="5,0,0,0" Padding="10,5,10,5" ItemsSource="{Binding Icons.Keys, Mode=OneTime}" Text="{Binding Icon, Mode=TwoWay}" />
|
<ComboBox Grid.Column="1" Margin="5,0,0,0" Padding="10,5,10,5" ItemsSource="{Binding Icons.Keys, Mode=OneTime}" Text="{Binding Icon, Mode=TwoWay}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ui:CardControl>
|
</ui:CardControl>
|
||||||
|
<ui:CardExpander Margin="0,8,0,0" Padding="16,13,16,12" IsExpanded="False">
|
||||||
|
<ui:CardExpander.Header>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0">
|
||||||
|
<TextBlock FontSize="14" Text="Bootstrapper customization" />
|
||||||
|
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Configure other customizable Bootstrapper options." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</ui:CardExpander.Header>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="0" Text="Title" VerticalAlignment="Center" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||||
|
<ui:TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Title, Mode=TwoWay}" />
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" Margin="0,4,0,0" FontSize="12" Text="The text that shows as the title of the bootstrapper." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0" Margin="0,12,0,0" Text="Custom Icon" VerticalAlignment="Center" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||||
|
<Grid Grid.Row="2" Grid.Column="1" Margin="0,12,0,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBox Grid.Column="0" Margin="0,0,4,0" Text="{Binding CustomIconLocation, Mode=TwoWay}" />
|
||||||
|
<ui:Button Grid.Column="1" Margin="4,0,0,0" Height="35" Icon="Folder24" Content="Browse" Command="{Binding BrowseCustomIconLocationCommand}" />
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="1" Margin="0,4,0,0" FontSize="12" Text="Must be a multi-size .ico file with sizes 16px to 128px. Set Icon as 'Custom' to use it." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||||
|
</Grid>
|
||||||
|
</ui:CardExpander>
|
||||||
<ui:Button Content="Preview" HorizontalAlignment="Stretch" Margin="0,8,0,0" Command="{Binding PreviewBootstrapperCommand}" />
|
<ui:Button Content="Preview" HorizontalAlignment="Stretch" Margin="0,8,0,0" Command="{Binding PreviewBootstrapperCommand}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ui:UiPage>
|
</ui:UiPage>
|
||||||
|
Loading…
Reference in New Issue
Block a user