Refactor UI code structuring

109 changed files :D
This commit is contained in:
pizzaboxer 2023-07-02 13:10:04 +01:00
parent 9ea7900c05
commit 94fe52245e
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
57 changed files with 165 additions and 182 deletions

View File

@ -17,8 +17,6 @@ using Bloxstrap.Extensions;
using Bloxstrap.Models;
using Bloxstrap.Models.Attributes;
using Bloxstrap.UI;
using Bloxstrap.UI.BootstrapperDialogs;
using Bloxstrap.UI.MessageBox;
using Bloxstrap.Utility;
namespace Bloxstrap
@ -105,6 +103,7 @@ namespace Bloxstrap
void FinalizeExceptionHandling(Exception exception)
{
#pragma warning disable 162
#if DEBUG
throw exception;
#endif
@ -113,6 +112,7 @@ namespace Bloxstrap
Controls.ShowExceptionDialog(exception);
Terminate(Bootstrapper.ERROR_INSTALL_FAILURE);
#pragma warning restore 162
}
protected override void OnStartup(StartupEventArgs e)
@ -248,7 +248,7 @@ namespace Bloxstrap
else
{
if (Process.GetProcessesByName(ProjectName).Length > 1 && !IsQuiet)
FluentMessageBox.Show(
Controls.ShowMessageBox(
$"{ProjectName} is currently running, likely as a background Roblox process. Please note that not all your changes will immediately apply until you close all currently open Roblox instances.",
MessageBoxImage.Information
);

View File

@ -18,7 +18,6 @@ using Bloxstrap.Integrations;
using Bloxstrap.Models;
using Bloxstrap.Tools;
using Bloxstrap.UI;
using Bloxstrap.UI.BootstrapperDialogs;
namespace Bloxstrap
{

View File

@ -1,24 +1,10 @@
using Bloxstrap.Enums;
using Bloxstrap.UI.BootstrapperDialogs;
using Bloxstrap.UI.BootstrapperDialogs.WinForms;
using Bloxstrap.UI.BootstrapperDialogs.WPF.Views;
using Bloxstrap.UI;
namespace Bloxstrap.Extensions
{
static class BootstrapperStyleEx
{
public static IBootstrapperDialog GetNew(this BootstrapperStyle bootstrapperStyle)
{
return bootstrapperStyle switch
{
BootstrapperStyle.VistaDialog => new VistaDialog(),
BootstrapperStyle.LegacyDialog2009 => new LegacyDialog2009(),
BootstrapperStyle.LegacyDialog2011 => new LegacyDialog2011(),
BootstrapperStyle.ProgressDialog => new ProgressDialog(),
BootstrapperStyle.FluentDialog => new FluentDialog(),
BootstrapperStyle.ByfronDialog => new ByfronDialog(),
_ => new FluentDialog()
};
}
public static IBootstrapperDialog GetNew(this BootstrapperStyle bootstrapperStyle) => Controls.GetBootstrapperDialog(bootstrapperStyle);
}
}

View File

@ -1,9 +1,10 @@
using System;
using System.Drawing;
using System.Windows;
using Bloxstrap.Enums;
using Bloxstrap.UI.Menu.Views;
using Bloxstrap.Extensions;
using Bloxstrap.UI.Elements.Bootstrapper;
using Bloxstrap.UI.Menu;
using Bloxstrap.UI.MessageBox;
namespace Bloxstrap.UI
@ -14,14 +15,22 @@ namespace Bloxstrap.UI
public static MessageBoxResult ShowMessageBox(string message, MessageBoxImage icon = MessageBoxImage.None, MessageBoxButton buttons = MessageBoxButton.OK, MessageBoxResult defaultResult = MessageBoxResult.None)
{
if (App.IsQuiet)
return defaultResult;
switch (App.Settings.Prop.BootstrapperStyle)
{
case BootstrapperStyle.FluentDialog:
case BootstrapperStyle.ByfronDialog:
return FluentMessageBox.Show(message, icon, buttons, defaultResult);
return Application.Current.Dispatcher.Invoke(new Func<MessageBoxResult>(() =>
{
var messagebox = new FluentMessageBox(message, icon, buttons);
messagebox.ShowDialog();
return messagebox.Result;
}));
default:
return NativeMessageBox.Show(message, icon, buttons, defaultResult);
return System.Windows.MessageBox.Show(message, App.ProjectName, buttons, icon);
}
}
@ -32,5 +41,19 @@ namespace Bloxstrap.UI
new ExceptionDialog(exception).ShowDialog();
});
}
public static IBootstrapperDialog GetBootstrapperDialog(BootstrapperStyle style)
{
return style switch
{
BootstrapperStyle.VistaDialog => new VistaDialog(),
BootstrapperStyle.LegacyDialog2009 => new LegacyDialog2009(),
BootstrapperStyle.LegacyDialog2011 => new LegacyDialog2011(),
BootstrapperStyle.ProgressDialog => new ProgressDialog(),
BootstrapperStyle.FluentDialog => new FluentDialog(),
BootstrapperStyle.ByfronDialog => new ByfronDialog(),
_ => new FluentDialog()
};
}
}
}

View File

@ -1,7 +1,7 @@
using System;
using System.Windows;
namespace Bloxstrap.UI.BootstrapperDialogs
namespace Bloxstrap.UI.Elements.Bootstrapper.Base
{
static class BaseFunctions
{

View File

@ -2,13 +2,13 @@
using System.Windows.Forms;
using Bloxstrap.Extensions;
using Bloxstrap.Utility;
using Bloxstrap.UI.Utility;
namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
namespace Bloxstrap.UI.Elements.Bootstrapper.Base
{
public class DialogBase : Form, IBootstrapperDialog
public class WinFormsDialogBase : Form, IBootstrapperDialog
{
public Bootstrapper? Bootstrapper { get; set; }
public Bloxstrap.Bootstrapper? Bootstrapper { get; set; }
#region UI Elements
protected virtual string _message { get; set; } = "Please wait...";

View File

@ -1,4 +1,4 @@
<Window x:Class="Bloxstrap.UI.BootstrapperDialogs.WPF.Views.ByfronDialog"
<Window x:Class="Bloxstrap.UI.Elements.Bootstrapper.ByfronDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@ -6,9 +6,10 @@ using System.Windows.Media.Imaging;
using Bloxstrap.Enums;
using Bloxstrap.Extensions;
using Bloxstrap.UI.BootstrapperDialogs.WPF.ViewModels;
using Bloxstrap.UI.Elements.Bootstrapper.Base;
using Bloxstrap.UI.ViewModels.Bootstrapper;
namespace Bloxstrap.UI.BootstrapperDialogs.WPF.Views
namespace Bloxstrap.UI.Elements.Bootstrapper
{
/// <summary>
/// Interaction logic for ByfronDialog.xaml
@ -17,7 +18,7 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WPF.Views
{
private readonly ByfronDialogViewModel _viewModel;
public Bootstrapper? Bootstrapper { get; set; }
public Bloxstrap.Bootstrapper? Bootstrapper { get; set; }
#region UI Elements
public string Message
@ -52,10 +53,12 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WPF.Views
public bool CancelEnabled
{
get => _viewModel.CancelButtonVisibility == Visibility.Visible;
get => _viewModel.CancelEnabled;
set
{
_viewModel.CancelButtonVisibility = (value ? Visibility.Visible : Visibility.Collapsed);
_viewModel.CancelEnabled = value;
_viewModel.OnPropertyChanged(nameof(_viewModel.CancelEnabled));
_viewModel.OnPropertyChanged(nameof(_viewModel.CancelButtonVisibility));
_viewModel.OnPropertyChanged(nameof(_viewModel.VersionTextVisibility));

View File

@ -1,4 +1,4 @@
<ui:UiWindow x:Class="Bloxstrap.UI.BootstrapperDialogs.WPF.Views.FluentDialog"
<ui:UiWindow x:Class="Bloxstrap.UI.Elements.Bootstrapper.FluentDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -38,7 +38,7 @@
</Grid>
<Border Grid.Row="2" Padding="15" Background="{ui:ThemeResource SolidBackgroundFillColorSecondaryBrush}">
<Button Margin="0" Content="{Binding CancelButtonText, Mode=OneWay}" Width="120" HorizontalAlignment="Right" IsEnabled="{Binding CancelButtonEnabled, Mode=OneWay}" Command="{Binding CancelInstallCommand}" />
<Button Margin="0" Content="Cancel" Width="120" HorizontalAlignment="Right" IsEnabled="{Binding CancelButtonEnabled, Mode=OneWay}" Command="{Binding CancelInstallCommand}" />
</Border>
</Grid>
</ui:UiWindow>

View File

@ -2,14 +2,15 @@
using System.Windows;
using System.Windows.Forms;
using Bloxstrap.Extensions;
using Bloxstrap.UI.BootstrapperDialogs.WPF.ViewModels;
using Wpf.Ui.Appearance;
using Wpf.Ui.Mvvm.Contracts;
using Wpf.Ui.Mvvm.Services;
namespace Bloxstrap.UI.BootstrapperDialogs.WPF.Views
using Bloxstrap.Extensions;
using Bloxstrap.UI.ViewModels.Bootstrapper;
using Bloxstrap.UI.Elements.Bootstrapper.Base;
namespace Bloxstrap.UI.Elements.Bootstrapper
{
/// <summary>
/// Interaction logic for FluentDialog.xaml
@ -18,9 +19,9 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WPF.Views
{
private readonly IThemeService _themeService = new ThemeService();
private readonly FluentDialogViewModel _viewModel;
private readonly BootstrapperDialogViewModel _viewModel;
public Bootstrapper? Bootstrapper { get; set; }
public Bloxstrap.Bootstrapper? Bootstrapper { get; set; }
#region UI Elements
public string Message
@ -55,21 +56,20 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WPF.Views
public bool CancelEnabled
{
get => _viewModel.CancelButtonVisibility == Visibility.Visible;
get => _viewModel.CancelEnabled;
set
{
_viewModel.CancelButtonVisibility = (value ? Visibility.Visible : Visibility.Collapsed);
_viewModel.CancelButtonEnabled = value;
_viewModel.CancelEnabled = value;
_viewModel.OnPropertyChanged(nameof(_viewModel.CancelButtonVisibility));
_viewModel.OnPropertyChanged(nameof(_viewModel.CancelButtonEnabled));
_viewModel.OnPropertyChanged(nameof(_viewModel.CancelEnabled));
}
}
#endregion
public FluentDialog()
{
_viewModel = new FluentDialogViewModel(this);
_viewModel = new BootstrapperDialogViewModel(this);
DataContext = _viewModel;
Title = App.Settings.Prop.BootstrapperTitle;
Icon = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();

View File

@ -1,6 +1,6 @@
using System.Windows.Forms;
namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
namespace Bloxstrap.UI.Elements.Bootstrapper
{
partial class LegacyDialog2009
{

View File

@ -1,12 +1,14 @@
using System;
using System.Windows.Forms;
namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
using Bloxstrap.UI.Elements.Bootstrapper.Base;
namespace Bloxstrap.UI.Elements.Bootstrapper
{
// windows: https://youtu.be/VpduiruysuM?t=18
// mac: https://youtu.be/ncHhbcVDRgQ?t=63
public partial class LegacyDialog2009 : DialogBase
public partial class LegacyDialog2009 : WinFormsDialogBase
{
protected override string _message
{

View File

@ -1,6 +1,6 @@
using System.Windows.Forms;
namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
namespace Bloxstrap.UI.Elements.Bootstrapper
{
partial class LegacyDialog2011
{

View File

@ -2,12 +2,13 @@ using System;
using System.Windows.Forms;
using Bloxstrap.Extensions;
using Bloxstrap.UI.Elements.Bootstrapper.Base;
namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
namespace Bloxstrap.UI.Elements.Bootstrapper
{
// https://youtu.be/3K9oCEMHj2s?t=35
public partial class LegacyDialog2011 : DialogBase
public partial class LegacyDialog2011 : WinFormsDialogBase
{
protected override string _message
{

View File

@ -1,6 +1,6 @@
using System.Windows.Forms;
namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
namespace Bloxstrap.UI.Elements.Bootstrapper
{
partial class ProgressDialog
{

View File

@ -4,12 +4,13 @@ using System.Windows.Forms;
using Bloxstrap.Enums;
using Bloxstrap.Extensions;
using Bloxstrap.UI.Elements.Bootstrapper.Base;
namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
namespace Bloxstrap.UI.Elements.Bootstrapper
{
// basically just the modern dialog
public partial class ProgressDialog : DialogBase
public partial class ProgressDialog : WinFormsDialogBase
{
protected override string _message
{

View File

@ -1,4 +1,4 @@
namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
namespace Bloxstrap.UI.Elements.Bootstrapper
{
partial class VistaDialog
{

View File

@ -2,8 +2,9 @@
using System.Windows.Forms;
using Bloxstrap.Extensions;
using Bloxstrap.UI.Elements.Bootstrapper.Base;
namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
namespace Bloxstrap.UI.Elements.Bootstrapper
{
// https://youtu.be/h0_AL95Sc3o?t=48
@ -11,7 +12,7 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
// since taskdialog is part of winforms, it can't really be properly used without a form
// for example, cross-threaded calls to ui controls can't really be done outside of a form
public partial class VistaDialog : DialogBase
public partial class VistaDialog : WinFormsDialogBase
{
private TaskDialogPage _dialogPage;

View File

@ -5,7 +5,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
using Bloxstrap.UI.Utility;
using Bloxstrap.Utility;
namespace Bloxstrap.UI.MessageBox
@ -19,22 +19,6 @@ namespace Bloxstrap.UI.MessageBox
{
public MessageBoxResult Result = MessageBoxResult.None;
public static MessageBoxResult Show(string message, MessageBoxImage icon = MessageBoxImage.None, MessageBoxButton buttons = MessageBoxButton.OK, MessageBoxResult defaultResult = MessageBoxResult.None)
{
if (App.IsQuiet)
return defaultResult;
// threading weirdness lol
MessageBoxResult result = Application.Current.Dispatcher.Invoke(new Func<MessageBoxResult>(() =>
{
var messagebox = new FluentMessageBox(message, icon, buttons);
messagebox.ShowDialog();
return messagebox.Result;
}));
return result;
}
public FluentMessageBox(string message, MessageBoxImage image, MessageBoxButton buttons)
{
InitializeComponent();

View File

@ -1,10 +1,10 @@
<ui:UiWindow x:Class="Bloxstrap.UI.Menu.Views.MainWindow"
<ui:UiWindow x:Class="Bloxstrap.UI.Menu.MainWindow"
x:Name="ConfigurationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:Bloxstrap.UI.Menu.Views.Pages"
xmlns:pages="clr-namespace:Bloxstrap.UI.Menu.Pages"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
Title="Bloxstrap Menu"

View File

@ -7,9 +7,9 @@ using Wpf.Ui.Mvvm.Contracts;
using Wpf.Ui.Mvvm.Services;
using Bloxstrap.Extensions;
using Bloxstrap.UI.Menu.ViewModels;
using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Views
namespace Bloxstrap.UI.Menu
{
/// <summary>
/// Interaction logic for MainWindow.xaml

View File

@ -1,9 +1,9 @@
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Views.Pages.AboutPage"
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Pages.AboutPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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.UI.Menu.ViewModels"
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="700" d:DesignWidth="800"

View File

@ -1,6 +1,6 @@
using Bloxstrap.UI.Menu.ViewModels;
using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Views.Pages
namespace Bloxstrap.UI.Menu.Pages
{
/// <summary>
/// Interaction logic for AboutPage.xaml

View File

@ -1,9 +1,8 @@
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Views.Pages.AppearancePage"
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Pages.AppearancePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:local="clr-namespace:Bloxstrap.UI.Menu.Views.Pages"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="520" d:DesignWidth="800"

View File

@ -1,6 +1,6 @@
using Bloxstrap.UI.Menu.ViewModels;
using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Views.Pages
namespace Bloxstrap.UI.Menu.Pages
{
/// <summary>
/// Interaction logic for AppearancePage.xaml

View File

@ -1,4 +1,4 @@
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Views.Pages.BehaviourPage"
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Pages.BehaviourPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@ -1,6 +1,6 @@
using Bloxstrap.UI.Menu.ViewModels;
using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Views.Pages
namespace Bloxstrap.UI.Menu.Pages
{
/// <summary>
/// Interaction logic for BehaviourPage.xaml

View File

@ -1,9 +1,9 @@
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Views.Pages.FastFlagsPage"
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Pages.FastFlagsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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.UI.Menu.ViewModels"
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="1000" d:DesignWidth="800"

View File

@ -1,9 +1,9 @@
using System;
using System.Windows.Input;
using Bloxstrap.UI.Menu.ViewModels;
using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Views.Pages
namespace Bloxstrap.UI.Menu.Pages
{
/// <summary>
/// Interaction logic for FastFlagsPage.xaml

View File

@ -1,9 +1,9 @@
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Views.Pages.InstallationPage"
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Pages.InstallationPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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.UI.Menu.ViewModels"
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"

View File

@ -3,9 +3,9 @@ using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using Bloxstrap.UI.Menu.ViewModels;
using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Views.Pages
namespace Bloxstrap.UI.Menu.Pages
{
/// <summary>
/// Interaction logic for InstallationPage.xaml

View File

@ -1,4 +1,4 @@
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Views.Pages.IntegrationsPage"
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Pages.IntegrationsPage"
x:Name="IntegrationsPageView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

View File

@ -1,9 +1,9 @@
using System.Windows.Controls;
using Bloxstrap.Models;
using Bloxstrap.UI.Menu.ViewModels;
using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Views.Pages
namespace Bloxstrap.UI.Menu.Pages
{
/// <summary>
/// Interaction logic for IntegrationsPage.xaml

View File

@ -1,9 +1,9 @@
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Views.Pages.ModsPage"
<ui:UiPage x:Class="Bloxstrap.UI.Menu.Pages.ModsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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.UI.Menu.ViewModels"
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="800"

View File

@ -1,9 +1,9 @@
using System;
using System.Windows;
using Bloxstrap.UI.Menu.ViewModels;
using Bloxstrap.UI.ViewModels.Menu;
namespace Bloxstrap.UI.Menu.Views.Pages
namespace Bloxstrap.UI.Menu.Pages
{
/// <summary>
/// Interaction logic for ModsPage.xaml

View File

@ -1,7 +1,7 @@
using System;
using System.Windows.Forms;
namespace Bloxstrap.UI.BootstrapperDialogs
namespace Bloxstrap.UI
{
public interface IBootstrapperDialog
{

View File

@ -1,15 +0,0 @@
using System.Windows;
namespace Bloxstrap.UI.MessageBox
{
static class NativeMessageBox
{
public static MessageBoxResult Show(string message, MessageBoxImage icon = MessageBoxImage.None, MessageBoxButton buttons = MessageBoxButton.OK, MessageBoxResult defaultResult = MessageBoxResult.None)
{
if (App.IsQuiet)
return defaultResult;
return System.Windows.MessageBox.Show(message, App.ProjectName, buttons, icon);
}
}
}

View File

@ -3,7 +3,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace Bloxstrap.Utility
namespace Bloxstrap.UI.Utility
{
static class Rendering
{

View File

@ -2,7 +2,7 @@
using System.Windows;
using System.Windows.Forms;
namespace Bloxstrap.Utility
namespace Bloxstrap.UI.Utility
{
public static class WindowScaling
{

View File

@ -7,9 +7,9 @@ using CommunityToolkit.Mvvm.Input;
using Bloxstrap.Extensions;
namespace Bloxstrap.UI.BootstrapperDialogs.WPF.ViewModels
namespace Bloxstrap.UI.ViewModels.Bootstrapper
{
public class FluentDialogViewModel : INotifyPropertyChanged
public class BootstrapperDialogViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
@ -24,11 +24,10 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WPF.ViewModels
public bool ProgressIndeterminate { get; set; } = true;
public int ProgressValue { get; set; } = 0;
public bool CancelButtonEnabled { get; set; } = false;
public Visibility CancelButtonVisibility { get; set; } = Visibility.Collapsed;
public string CancelButtonText { get; set; } = "Cancel";
public bool CancelEnabled { get; set; } = false;
public Visibility CancelButtonVisibility => CancelEnabled ? Visibility.Visible : Visibility.Collapsed;
public FluentDialogViewModel(IBootstrapperDialog dialog)
public BootstrapperDialogViewModel(IBootstrapperDialog dialog)
{
_dialog = dialog;
}

View File

@ -6,9 +6,9 @@ using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace Bloxstrap.UI.BootstrapperDialogs.WPF.ViewModels
namespace Bloxstrap.UI.ViewModels.Bootstrapper
{
public class ByfronDialogViewModel : FluentDialogViewModel, INotifyPropertyChanged
public class ByfronDialogViewModel : BootstrapperDialogViewModel, INotifyPropertyChanged
{
// Using dark theme for default values.
public ImageSource ByfronLogoLocation { get; set; } = new BitmapImage(new Uri("pack://application:,,,/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoDark.jpg"));
@ -18,7 +18,8 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WPF.ViewModels
public Brush IconColor { get; set; } = new SolidColorBrush(Color.FromRgb(255, 255, 255));
public Brush ProgressBarBackground { get; set; } = new SolidColorBrush(Color.FromRgb(86, 86, 86));
public Visibility VersionTextVisibility => CancelButtonVisibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
public Visibility VersionTextVisibility => CancelEnabled ? Visibility.Collapsed : Visibility.Visible;
public string VersionText
{
get

View File

@ -1,7 +1,7 @@
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
namespace Bloxstrap.UI.Menu.ViewModels
namespace Bloxstrap.UI.ViewModels
{
public static class GlobalViewModel
{

View File

@ -4,7 +4,7 @@ using System.Windows;
using Bloxstrap.Extensions;
using Bloxstrap.Models.Attributes;
namespace Bloxstrap.UI.Menu.ViewModels
namespace Bloxstrap.UI.ViewModels.Menu
{
public class AboutViewModel
{
@ -16,6 +16,6 @@ namespace Bloxstrap.UI.Menu.ViewModels
public string BuildCommitHashUrl => $"https://github.com/{App.ProjectRepository}/commit/{BuildMetadata.CommitHash}";
public Visibility BuildInformationVisibility => BuildMetadata.CommitRef.StartsWith("tag") ? Visibility.Collapsed : Visibility.Visible;
public Visibility BuildCommitVisibility => String.IsNullOrEmpty(BuildMetadata.CommitHash) ? Visibility.Collapsed : Visibility.Visible;
public Visibility BuildCommitVisibility => string.IsNullOrEmpty(BuildMetadata.CommitHash) ? Visibility.Collapsed : Visibility.Visible;
}
}

View File

@ -11,10 +11,9 @@ using CommunityToolkit.Mvvm.Input;
using Bloxstrap.Enums;
using Bloxstrap.Extensions;
using Bloxstrap.UI.BootstrapperDialogs;
using Bloxstrap.UI.Menu.Views;
using Bloxstrap.UI.Menu;
namespace Bloxstrap.UI.Menu.ViewModels
namespace Bloxstrap.UI.ViewModels.Menu
{
public class AppearanceViewModel : INotifyPropertyChanged
{

View File

@ -1,4 +1,4 @@
namespace Bloxstrap.UI.Menu.ViewModels
namespace Bloxstrap.UI.ViewModels.Menu
{
public class BehaviourViewModel
{

View File

@ -5,7 +5,7 @@ using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
namespace Bloxstrap.UI.Menu.ViewModels
namespace Bloxstrap.UI.ViewModels.Menu
{
public class FastFlagsViewModel : INotifyPropertyChanged
{

View File

@ -14,7 +14,7 @@ using Bloxstrap.Enums;
using Bloxstrap.Extensions;
using Bloxstrap.Models;
namespace Bloxstrap.UI.Menu.ViewModels
namespace Bloxstrap.UI.ViewModels.Menu
{
public class InstallationViewModel : INotifyPropertyChanged
{

View File

@ -6,7 +6,7 @@ using CommunityToolkit.Mvvm.Input;
using Bloxstrap.Models;
namespace Bloxstrap.UI.Menu.ViewModels
namespace Bloxstrap.UI.ViewModels.Menu
{
public class IntegrationsViewModel : INotifyPropertyChanged
{

View File

@ -12,7 +12,7 @@ using Wpf.Ui.Mvvm.Contracts;
using Bloxstrap.UI.MessageBox;
namespace Bloxstrap.UI.Menu.ViewModels
namespace Bloxstrap.UI.ViewModels.Menu
{
public class MainWindowViewModel
{
@ -37,7 +37,7 @@ namespace Bloxstrap.UI.Menu.ViewModels
{
if (string.IsNullOrEmpty(App.BaseDirectory))
{
FluentMessageBox.Show("You must set an install location", MessageBoxImage.Error);
Controls.ShowMessageBox("You must set an install location", MessageBoxImage.Error);
return;
}
@ -52,7 +52,7 @@ namespace Bloxstrap.UI.Menu.ViewModels
}
catch (UnauthorizedAccessException)
{
FluentMessageBox.Show(
Controls.ShowMessageBox(
$"{App.ProjectName} does not have write access to the install location you selected. Please choose another install location.",
MessageBoxImage.Error
);
@ -60,7 +60,7 @@ namespace Bloxstrap.UI.Menu.ViewModels
}
catch (Exception ex)
{
FluentMessageBox.Show(ex.Message, MessageBoxImage.Error);
Controls.ShowMessageBox(ex.Message, MessageBoxImage.Error);
return;
}
@ -73,7 +73,7 @@ namespace Bloxstrap.UI.Menu.ViewModels
{
App.Logger.WriteLine($"[MainWindowViewModel::ConfirmSettings] Changing install location from {_originalBaseDirectory} to {App.BaseDirectory}");
FluentMessageBox.Show(
Controls.ShowMessageBox(
$"{App.ProjectName} will install to the new location you've set the next time it runs.",
MessageBoxImage.Information
);

View File

@ -8,7 +8,7 @@ using Bloxstrap.Extensions;
using CommunityToolkit.Mvvm.Input;
namespace Bloxstrap.UI.Menu.ViewModels
namespace Bloxstrap.UI.ViewModels.Menu
{
public class ModsViewModel
{