diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 381965a..a0d9963 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -629,6 +629,9 @@ namespace Bloxstrap if (Directory.Exists(AppData.Directory)) { + if (Directory.Exists(AppData.OldDirectory)) + Directory.Delete(AppData.OldDirectory, true); + try { // test to see if any files are in use diff --git a/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml b/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml index 925a520..9620493 100644 --- a/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml +++ b/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml @@ -10,6 +10,7 @@ xmlns:resources="clr-namespace:Bloxstrap.Resources" mc:Ignorable="d" d:DesignHeight="1500" d:DesignWidth="800" + SizeChanged="UiPage_SizeChanged" Title="AboutPage" Scrollable="True"> @@ -93,7 +94,7 @@ - + @@ -122,7 +123,7 @@ - + diff --git a/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml.cs b/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml.cs index c824558..546d2e4 100644 --- a/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml.cs +++ b/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml.cs @@ -1,4 +1,6 @@ -using Bloxstrap.UI.ViewModels.About; +using System.Windows; + +using Bloxstrap.UI.ViewModels.About; namespace Bloxstrap.UI.Elements.About.Pages { @@ -7,10 +9,15 @@ namespace Bloxstrap.UI.Elements.About.Pages /// public partial class SupportersPage { + private readonly SupportersViewModel _viewModel = new(); + public SupportersPage() { - DataContext = new SupportersViewModel(); + DataContext = _viewModel; InitializeComponent(); } + + private void UiPage_SizeChanged(object sender, SizeChangedEventArgs e) + => _viewModel.WindowResizeEvent?.Invoke(sender, e); } } diff --git a/Bloxstrap/UI/ViewModels/About/SupportersViewModel.cs b/Bloxstrap/UI/ViewModels/About/SupportersViewModel.cs index cc5afbc..8fca94b 100644 --- a/Bloxstrap/UI/ViewModels/About/SupportersViewModel.cs +++ b/Bloxstrap/UI/ViewModels/About/SupportersViewModel.cs @@ -1,4 +1,6 @@ -namespace Bloxstrap.UI.ViewModels.About +using System.Windows; + +namespace Bloxstrap.UI.ViewModels.About { public class SupportersViewModel : NotifyPropertyChangedViewModel { @@ -8,12 +10,32 @@ public string LoadError { get; set; } = ""; + public int Columns { get; set; } = 3; + + public SizeChangedEventHandler? WindowResizeEvent; + public SupportersViewModel() { + WindowResizeEvent += OnWindowResize; + // this will cause momentary freezes only when ran under the debugger LoadSupporterData(); } + private void OnWindowResize(object sender, SizeChangedEventArgs e) + { + if (!e.WidthChanged) + return; + + int newCols = (int)Math.Floor(e.NewSize.Width / 200); + + if (Columns == newCols) + return; + + Columns = newCols; + OnPropertyChanged(nameof(Columns)); + } + public async void LoadSupporterData() { const string LOG_IDENT = "AboutViewModel::LoadSupporterData";