mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
* add taskbar progress bar does not support winform bootstrappers * add winforms taskbar progress bar * fix build
47 lines
1.6 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|