MetaforceInstaller/MetaforceInstaller.UI/ViewModels/MainWindowViewModel.cs

28 lines
No EOL
847 B
C#

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using MetaforceInstaller.Core.Models;
namespace MetaforceInstaller.UI.ViewModels;
public class MainWindowViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
public ObservableCollection<InstallationData> Installations { get; set; } = new();
public void LoadInstallations(IEnumerable<InstallationData> data)
{
Installations.Clear();
foreach (var installation in data)
{
Installations.Add(installation);
}
}
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}