diff --git a/Bloxstrap/Dialogs/ProgressDialog.cs b/Bloxstrap/Dialogs/ProgressDialog.cs
index 13abe7c..7a9e88a 100644
--- a/Bloxstrap/Dialogs/ProgressDialog.cs
+++ b/Bloxstrap/Dialogs/ProgressDialog.cs
@@ -3,6 +3,7 @@ using System.Drawing;
using System.Windows.Forms;
using Bloxstrap.Enums;
+using Bloxstrap.Helpers.Extensions;
namespace Bloxstrap.Dialogs
{
@@ -46,7 +47,7 @@ namespace Bloxstrap.Dialogs
this.BackColor = Color.FromArgb(25, 27, 29);
}
- this.IconBox.BackgroundImage = App.Settings.Prop.BootstrapperIcon.GetIconWithSize(new Size(128, 128)).ToBitmap();
+ this.IconBox.BackgroundImage = App.Settings.Prop.BootstrapperIcon.GetIcon().GetSized(128, 128).ToBitmap();
SetupDialog();
}
diff --git a/Bloxstrap/Enums/BootstrapperIcon.cs b/Bloxstrap/Enums/BootstrapperIcon.cs
index 718349b..2db24c7 100644
--- a/Bloxstrap/Enums/BootstrapperIcon.cs
+++ b/Bloxstrap/Enums/BootstrapperIcon.cs
@@ -38,14 +38,5 @@ namespace Bloxstrap.Enums
_ => Properties.Resources.IconBloxstrap
};
}
-
- public static Icon GetIconWithSize(this BootstrapperIcon icon, Size size) => new(icon.GetIcon(), size);
-
- public static ImageSource GetImageSource(this BootstrapperIcon icon)
- {
- using MemoryStream stream = new();
- icon.GetIcon().Save(stream);
- return BitmapFrame.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
- }
}
}
diff --git a/Bloxstrap/Helpers/Extensions/IconEx.cs b/Bloxstrap/Helpers/Extensions/IconEx.cs
new file mode 100644
index 0000000..5144c5a
--- /dev/null
+++ b/Bloxstrap/Helpers/Extensions/IconEx.cs
@@ -0,0 +1,19 @@
+using System.Drawing;
+using System.IO;
+using System.Windows.Media.Imaging;
+using System.Windows.Media;
+
+namespace Bloxstrap.Helpers.Extensions
+{
+ public static class IconEx
+ {
+ public static Icon GetSized(this Icon icon, int width, int height) => new(icon, new Size(width, height));
+
+ public static ImageSource GetImageSource(this Icon icon)
+ {
+ using MemoryStream stream = new();
+ icon.Save(stream);
+ return BitmapFrame.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
+ }
+ }
+}
diff --git a/Bloxstrap/ViewModels/BootstrapperViewModel.cs b/Bloxstrap/ViewModels/BootstrapperViewModel.cs
index d9a01d7..cff73fb 100644
--- a/Bloxstrap/ViewModels/BootstrapperViewModel.cs
+++ b/Bloxstrap/ViewModels/BootstrapperViewModel.cs
@@ -1,13 +1,16 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
+using System.Windows.Media;
using Bloxstrap.Dialogs;
using Bloxstrap.Enums;
+using Bloxstrap.Helpers.Extensions;
using Bloxstrap.Views;
using CommunityToolkit.Mvvm.Input;
using Wpf.Ui.Mvvm.Services;
@@ -15,8 +18,11 @@ using Wpf.Ui.Mvvm.Contracts;
namespace Bloxstrap.ViewModels
{
- public class BootstrapperViewModel
+ public class BootstrapperViewModel : INotifyPropertyChanged
{
+ public event PropertyChangedEventHandler? PropertyChanged;
+ public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+
private readonly Page _page;
public ICommand PreviewBootstrapperCommand => new RelayCommand(PreviewBootstrapper);
@@ -100,7 +106,13 @@ namespace Bloxstrap.ViewModels
public string Icon
{
get => Icons.FirstOrDefault(x => x.Value == App.Settings.Prop.BootstrapperIcon).Key;
- set => App.Settings.Prop.BootstrapperIcon = Icons[value];
+ set
+ {
+ App.Settings.Prop.BootstrapperIcon = Icons[value];
+ OnPropertyChanged(nameof(IconPreviewSource));
+ }
}
+
+ public ImageSource IconPreviewSource => App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();
}
}
diff --git a/Bloxstrap/ViewModels/FluentDialogViewModel.cs b/Bloxstrap/ViewModels/FluentDialogViewModel.cs
index a2090cb..2b639a6 100644
--- a/Bloxstrap/ViewModels/FluentDialogViewModel.cs
+++ b/Bloxstrap/ViewModels/FluentDialogViewModel.cs
@@ -10,6 +10,7 @@ using System.Windows.Media;
using CommunityToolkit.Mvvm.Input;
using Bloxstrap.Dialogs;
using Bloxstrap.Enums;
+using Bloxstrap.Helpers.Extensions;
namespace Bloxstrap.ViewModels
{
@@ -21,7 +22,7 @@ namespace Bloxstrap.ViewModels
public ICommand CancelInstallCommand => new RelayCommand(CancelInstall);
- public ImageSource Icon { get; set; } = App.Settings.Prop.BootstrapperIcon.GetImageSource();
+ public ImageSource Icon { get; set; } = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();
public string Message { get; set; } = "Please wait...";
public bool ProgressIndeterminate { get; set; } = true;
public int ProgressValue { get; set; } = 0;
diff --git a/Bloxstrap/Views/Pages/BootstrapperPage.xaml b/Bloxstrap/Views/Pages/BootstrapperPage.xaml
index b60320a..136f65e 100644
--- a/Bloxstrap/Views/Pages/BootstrapperPage.xaml
+++ b/Bloxstrap/Views/Pages/BootstrapperPage.xaml
@@ -6,7 +6,7 @@
xmlns:models="clr-namespace:Bloxstrap.ViewModels"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800"
+ d:DesignHeight="600" d:DesignWidth="800"
Title="BootstrapperPage"
Scrollable="True">
@@ -69,7 +69,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
+