bloxstrap/Bloxstrap/UI/ViewModels/Bootstrapper/BootstrapperDialogViewModel.cs
Matt 4f1b4f2737
Add taskbar progress bar (#2757)
* add taskbar progress bar

does not support winform bootstrappers

* add winforms taskbar progress bar

* fix build
2024-10-03 10:24:01 +01:00

47 lines
1.6 KiB
C#

using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shell;
using CommunityToolkit.Mvvm.Input;
namespace Bloxstrap.UI.ViewModels.Bootstrapper
{
public class BootstrapperDialogViewModel : NotifyPropertyChangedViewModel
{
private readonly IBootstrapperDialog _dialog;
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 string Message { get; set; } = "Please wait...";
public bool ProgressIndeterminate { get; set; } = true;
public int ProgressMaximum { get; set; } = 0;
public int ProgressValue { get; set; } = 0;
public TaskbarItemProgressState TaskbarProgressState { get; set; } = TaskbarItemProgressState.Indeterminate;
public double TaskbarProgressValue { get; set; } = 0;
public bool CancelEnabled { get; set; } = false;
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)
{
_dialog = dialog;
}
private void CancelInstall()
{
_dialog.Bootstrapper?.Cancel();
_dialog.CloseBootstrapper();
}
}
}