mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Merge pull request #1242 from bluepilledgreat/feature/fluent-progress
Fluent progress dialogs
This commit is contained in:
commit
9d50ffcab5
@ -7,6 +7,8 @@
|
|||||||
LegacyDialog2011,
|
LegacyDialog2011,
|
||||||
ProgressDialog,
|
ProgressDialog,
|
||||||
FluentDialog,
|
FluentDialog,
|
||||||
ByfronDialog
|
ByfronDialog,
|
||||||
|
ProgressFluentDialog,
|
||||||
|
ProgressFluentAeroDialog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,16 @@
|
|||||||
static class BootstrapperStyleEx
|
static class BootstrapperStyleEx
|
||||||
{
|
{
|
||||||
public static IBootstrapperDialog GetNew(this BootstrapperStyle bootstrapperStyle) => Frontend.GetBootstrapperDialog(bootstrapperStyle);
|
public static IBootstrapperDialog GetNew(this BootstrapperStyle bootstrapperStyle) => Frontend.GetBootstrapperDialog(bootstrapperStyle);
|
||||||
|
|
||||||
|
public static IReadOnlyCollection<BootstrapperStyle> Selections => new BootstrapperStyle[]
|
||||||
|
{
|
||||||
|
BootstrapperStyle.FluentDialog,
|
||||||
|
BootstrapperStyle.ProgressFluentDialog,
|
||||||
|
BootstrapperStyle.ProgressFluentAeroDialog,
|
||||||
|
BootstrapperStyle.ByfronDialog,
|
||||||
|
BootstrapperStyle.LegacyDialog2011,
|
||||||
|
BootstrapperStyle.LegacyDialog2008,
|
||||||
|
BootstrapperStyle.VistaDialog
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
Bloxstrap/Resources/Strings.Designer.cs
generated
18
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -846,6 +846,24 @@ namespace Bloxstrap.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Fluent Progress (Aero).
|
||||||
|
/// </summary>
|
||||||
|
public static string Enums_BootstrapperStyle_ProgressFluentAeroDialog {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Enums.BootstrapperStyle.ProgressFluentAeroDialog", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Fluent Progress.
|
||||||
|
/// </summary>
|
||||||
|
public static string Enums_BootstrapperStyle_ProgressFluentDialog {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Enums.BootstrapperStyle.ProgressFluentDialog", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Vista (2008 - 2011).
|
/// Looks up a localized string similar to Vista (2008 - 2011).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -383,6 +383,12 @@ Your ReShade configuration files will still be saved, and you can locate them by
|
|||||||
<data name="Enums.BootstrapperStyle.ProgressDialog" xml:space="preserve">
|
<data name="Enums.BootstrapperStyle.ProgressDialog" xml:space="preserve">
|
||||||
<value>Progress (~2014)</value>
|
<value>Progress (~2014)</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Enums.BootstrapperStyle.ProgressFluentAeroDialog" xml:space="preserve">
|
||||||
|
<value>Fluent Progress (Aero)</value>
|
||||||
|
</data>
|
||||||
|
<data name="Enums.BootstrapperStyle.ProgressFluentDialog" xml:space="preserve">
|
||||||
|
<value>Fluent Progress</value>
|
||||||
|
</data>
|
||||||
<data name="Enums.BootstrapperStyle.VistaDialog" xml:space="preserve">
|
<data name="Enums.BootstrapperStyle.VistaDialog" xml:space="preserve">
|
||||||
<value>Vista (2008 - 2011)</value>
|
<value>Vista (2008 - 2011)</value>
|
||||||
</data>
|
</data>
|
||||||
|
80
Bloxstrap/UI/Elements/Bootstrapper/ProgressFluentDialog.xaml
Normal file
80
Bloxstrap/UI/Elements/Bootstrapper/ProgressFluentDialog.xaml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<base:WpfUiWindow
|
||||||
|
x:Class="Bloxstrap.UI.Elements.Bootstrapper.ProgressFluentDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:resources="clr-namespace:Bloxstrap.Resources"
|
||||||
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
|
xmlns:vms="clr-namespace:Bloxstrap.UI.ViewModels.Bootstrapper"
|
||||||
|
Width="500"
|
||||||
|
Height="280"
|
||||||
|
MinHeight="0"
|
||||||
|
d:DataContext="{d:DesignInstance vms:ProgressFluentDialogViewModel,
|
||||||
|
IsDesignTimeCreatable=True}"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="{ui:ThemeResource ApplicationBackgroundBrush}"
|
||||||
|
Closing="UiWindow_Closing"
|
||||||
|
ExtendsContentIntoTitleBar="True"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowBackdropType="{Binding Path=WindowBackdropType, Mode=OneTime}"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
WindowStyle="None"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<!-- Background is for Aero theme only -->
|
||||||
|
<Grid Background="{Binding Path=BackgroundColourBrush, Mode=OneTime}">
|
||||||
|
<!-- Allow for drag -->
|
||||||
|
<ui:TitleBar
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
CanMaximize="False"
|
||||||
|
ShowClose="False"
|
||||||
|
ShowMaximize="False"
|
||||||
|
ShowMinimize="False" />
|
||||||
|
|
||||||
|
<Grid Margin="32,16">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Image
|
||||||
|
Grid.Row="0"
|
||||||
|
Width="80"
|
||||||
|
Height="80"
|
||||||
|
Margin="0,30,0,0"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
RenderOptions.BitmapScalingMode="HighQuality"
|
||||||
|
Source="{Binding Icon, Mode=OneWay}" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="1"
|
||||||
|
Margin="0,0,0,8"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
FontSize="18"
|
||||||
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||||
|
Text="{Binding Message, Mode=OneWay}" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
Grid.Row="2"
|
||||||
|
Margin="0,0,0,16"
|
||||||
|
IsIndeterminate="{Binding ProgressIndeterminate, Mode=OneWay}"
|
||||||
|
Maximum="{Binding ProgressMaximum, Mode=OneWay}"
|
||||||
|
Value="{Binding ProgressValue, Mode=OneWay}" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Grid.Row="3"
|
||||||
|
Width="120"
|
||||||
|
Padding="4"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Command="{Binding CancelInstallCommand}"
|
||||||
|
Content="{x:Static resources:Strings.Common_Cancel}"
|
||||||
|
FontSize="14"
|
||||||
|
IsEnabled="{Binding CancelEnabled, Mode=OneWay}" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</base:WpfUiWindow>
|
117
Bloxstrap/UI/Elements/Bootstrapper/ProgressFluentDialog.xaml.cs
Normal file
117
Bloxstrap/UI/Elements/Bootstrapper/ProgressFluentDialog.xaml.cs
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
using Bloxstrap.UI.Elements.Bootstrapper.Base;
|
||||||
|
using Bloxstrap.UI.ViewModels.Bootstrapper;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace Bloxstrap.UI.Elements.Bootstrapper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ProgressFluentDialog.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ProgressFluentDialog : IBootstrapperDialog
|
||||||
|
{
|
||||||
|
private readonly ProgressFluentDialogViewModel _viewModel;
|
||||||
|
|
||||||
|
public Bloxstrap.Bootstrapper? Bootstrapper { get; set; }
|
||||||
|
|
||||||
|
private bool _isClosing;
|
||||||
|
|
||||||
|
#region UI Elements
|
||||||
|
public string Message
|
||||||
|
{
|
||||||
|
get => _viewModel.Message;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_viewModel.Message = value;
|
||||||
|
_viewModel.OnPropertyChanged(nameof(_viewModel.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProgressBarStyle ProgressStyle
|
||||||
|
{
|
||||||
|
get => _viewModel.ProgressIndeterminate ? ProgressBarStyle.Marquee : ProgressBarStyle.Continuous;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_viewModel.ProgressIndeterminate = (value == ProgressBarStyle.Marquee);
|
||||||
|
_viewModel.OnPropertyChanged(nameof(_viewModel.ProgressIndeterminate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ProgressMaximum
|
||||||
|
{
|
||||||
|
get => _viewModel.ProgressMaximum;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_viewModel.ProgressMaximum = value;
|
||||||
|
_viewModel.OnPropertyChanged(nameof(_viewModel.ProgressMaximum));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ProgressValue
|
||||||
|
{
|
||||||
|
get => _viewModel.ProgressValue;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_viewModel.ProgressValue = value;
|
||||||
|
_viewModel.OnPropertyChanged(nameof(_viewModel.ProgressValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CancelEnabled
|
||||||
|
{
|
||||||
|
get => _viewModel.CancelEnabled;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_viewModel.CancelEnabled = value;
|
||||||
|
|
||||||
|
_viewModel.OnPropertyChanged(nameof(_viewModel.CancelButtonVisibility));
|
||||||
|
_viewModel.OnPropertyChanged(nameof(_viewModel.CancelEnabled));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public ProgressFluentDialog(bool aero)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
ApplyTheme();
|
||||||
|
|
||||||
|
_viewModel = new ProgressFluentDialogViewModel(this, aero);
|
||||||
|
DataContext = _viewModel;
|
||||||
|
Title = App.Settings.Prop.BootstrapperTitle;
|
||||||
|
Icon = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UiWindow_Closing(object sender, CancelEventArgs e)
|
||||||
|
{
|
||||||
|
if (!_isClosing)
|
||||||
|
Bootstrapper?.CancelInstall();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IBootstrapperDialog Methods
|
||||||
|
public void ShowBootstrapper() => this.ShowDialog();
|
||||||
|
|
||||||
|
public void CloseBootstrapper()
|
||||||
|
{
|
||||||
|
_isClosing = true;
|
||||||
|
Dispatcher.BeginInvoke(this.Close);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowSuccess(string message, Action? callback) => BaseFunctions.ShowSuccess(message, callback);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -57,6 +57,8 @@ namespace Bloxstrap.UI
|
|||||||
BootstrapperStyle.ProgressDialog => new ProgressDialog(),
|
BootstrapperStyle.ProgressDialog => new ProgressDialog(),
|
||||||
BootstrapperStyle.FluentDialog => new FluentDialog(),
|
BootstrapperStyle.FluentDialog => new FluentDialog(),
|
||||||
BootstrapperStyle.ByfronDialog => new ByfronDialog(),
|
BootstrapperStyle.ByfronDialog => new ByfronDialog(),
|
||||||
|
BootstrapperStyle.ProgressFluentDialog => new ProgressFluentDialog(false),
|
||||||
|
BootstrapperStyle.ProgressFluentAeroDialog => new ProgressFluentDialog(true),
|
||||||
_ => new FluentDialog()
|
_ => new FluentDialog()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,12 @@ namespace Bloxstrap.UI.ViewModels.Bootstrapper
|
|||||||
public bool CancelEnabled { get; set; } = false;
|
public bool CancelEnabled { get; set; } = false;
|
||||||
public Visibility CancelButtonVisibility => CancelEnabled ? Visibility.Visible : Visibility.Collapsed;
|
public Visibility CancelButtonVisibility => CancelEnabled ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|
||||||
|
[Obsolete("Do not use this! This is for the designer only.", true)]
|
||||||
|
public BootstrapperDialogViewModel()
|
||||||
|
{
|
||||||
|
_dialog = null!;
|
||||||
|
}
|
||||||
|
|
||||||
public BootstrapperDialogViewModel(IBootstrapperDialog dialog)
|
public BootstrapperDialogViewModel(IBootstrapperDialog dialog)
|
||||||
{
|
{
|
||||||
_dialog = dialog;
|
_dialog = dialog;
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Wpf.Ui.Appearance;
|
||||||
|
|
||||||
|
namespace Bloxstrap.UI.ViewModels.Bootstrapper
|
||||||
|
{
|
||||||
|
public class ProgressFluentDialogViewModel : BootstrapperDialogViewModel
|
||||||
|
{
|
||||||
|
public BackgroundType WindowBackdropType { get; set; } = BackgroundType.Mica;
|
||||||
|
public SolidColorBrush BackgroundColourBrush { get; set; } = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
|
||||||
|
|
||||||
|
[Obsolete("Do not use this! This is for the designer only.", true)]
|
||||||
|
public ProgressFluentDialogViewModel() : base()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public ProgressFluentDialogViewModel(IBootstrapperDialog dialog, bool aero) : base(dialog)
|
||||||
|
{
|
||||||
|
const int alpha = 128;
|
||||||
|
|
||||||
|
WindowBackdropType = aero ? BackgroundType.Aero : BackgroundType.Mica;
|
||||||
|
|
||||||
|
if (aero)
|
||||||
|
BackgroundColourBrush = App.Settings.Prop.Theme.GetFinal() == Enums.Theme.Light ?
|
||||||
|
new SolidColorBrush(Color.FromArgb(alpha, 225, 225, 225)) :
|
||||||
|
new SolidColorBrush(Color.FromArgb(alpha, 30, 30, 30));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -65,7 +65,7 @@ namespace Bloxstrap.UI.ViewModels.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<BootstrapperStyle> Dialogs { get; } = Enum.GetValues(typeof(BootstrapperStyle)).Cast<BootstrapperStyle>();
|
public IEnumerable<BootstrapperStyle> Dialogs { get; } = BootstrapperStyleEx.Selections;
|
||||||
|
|
||||||
public BootstrapperStyle Dialog
|
public BootstrapperStyle Dialog
|
||||||
{
|
{
|
||||||
|
2
wpfui
2
wpfui
@ -1 +1 @@
|
|||||||
Subproject commit 2a50f387e6c3b0a9160f3ce42bc95fbb7185e87d
|
Subproject commit 8f61545b386cc393f4502fb485cae9f052afbd46
|
Loading…
Reference in New Issue
Block a user