bloxstrap/Bloxstrap/UI/ViewModels/Bootstrapper/BootstrapperDialogViewModel.cs
pizzaboxer 94fe52245e
Refactor UI code structuring
109 changed files :D
2023-07-02 13:10:04 +01:00

42 lines
1.4 KiB
C#

using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using CommunityToolkit.Mvvm.Input;
using Bloxstrap.Extensions;
namespace Bloxstrap.UI.ViewModels.Bootstrapper
{
public class BootstrapperDialogViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
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 ProgressValue { get; set; } = 0;
public bool CancelEnabled { get; set; } = false;
public Visibility CancelButtonVisibility => CancelEnabled ? Visibility.Visible : Visibility.Collapsed;
public BootstrapperDialogViewModel(IBootstrapperDialog dialog)
{
_dialog = dialog;
}
private void CancelInstall()
{
_dialog.Bootstrapper?.CancelInstall();
_dialog.CloseBootstrapper();
}
}
}