39 lines
888 B
C#
39 lines
888 B
C#
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using gregExtractor.Models;
|
|
|
|
namespace gregExtractor.GUI.ViewModels;
|
|
|
|
public sealed class HookGroupViewModel : ObservableObject
|
|
{
|
|
private bool _isSelected = true;
|
|
|
|
public HookGroupViewModel(string groupName, string description)
|
|
{
|
|
GroupName = groupName;
|
|
Description = description;
|
|
}
|
|
|
|
public string GroupName { get; }
|
|
|
|
public string Description { get; }
|
|
|
|
public ObservableCollection<HookDefinition> Hooks { get; } = new();
|
|
|
|
public int Count => Hooks.Count;
|
|
|
|
public bool IsSelected
|
|
{
|
|
get => _isSelected;
|
|
set => SetProperty(ref _isSelected, value);
|
|
}
|
|
|
|
public void ReplaceHooks(IEnumerable<HookDefinition> hooks)
|
|
{
|
|
Hooks.Clear();
|
|
foreach (HookDefinition hook in hooks)
|
|
Hooks.Add(hook);
|
|
|
|
OnPropertyChanged(nameof(Count));
|
|
}
|
|
}
|