bloxstrap/Bloxstrap/UI/ViewModels/Installer/MainWindowViewModel.cs
pizzaboxer 776dbc4097
Draft: new installer system
the beginning of a long arduous cleanup of two years of debt
2024-08-10 13:08:04 +01:00

53 lines
1.6 KiB
C#

using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
using Bloxstrap.Resources;
namespace Bloxstrap.UI.ViewModels.Installer
{
public class MainWindowViewModel : NotifyPropertyChangedViewModel
{
public string NextButtonText { get; private set; } = Strings.Common_Navigation_Next;
public bool BackButtonEnabled { get; private set; } = false;
public bool NextButtonEnabled { get; private set; } = false;
public ICommand BackPageCommand => new RelayCommand(BackPage);
public ICommand NextPageCommand => new RelayCommand(NextPage);
public ICommand CloseWindowCommand => new RelayCommand(CloseWindow);
public event EventHandler<string>? PageRequest;
public event EventHandler? CloseWindowRequest;
public void SetButtonEnabled(string type, bool state)
{
if (type == "next")
{
NextButtonEnabled = state;
OnPropertyChanged(nameof(NextButtonEnabled));
}
else if (type == "back")
{
BackButtonEnabled = state;
OnPropertyChanged(nameof(BackButtonEnabled));
}
}
public void SetNextButtonText(string text)
{
NextButtonText = text;
OnPropertyChanged(nameof(NextButtonText));
}
private void BackPage() => PageRequest?.Invoke(this, "back");
private void NextPage() => PageRequest?.Invoke(this, "next");
private void CloseWindow() => CloseWindowRequest?.Invoke(this, new EventArgs());
}
}