using System; using System.Collections.Generic; using System.Linq; using System.Reactive; using Artemis.Core; using ReactiveUI; namespace Artemis.UI.Screens.VisualScripting; public class NodeMenuItemViewModel { public NodeMenuItemViewModel(ReactiveCommand createNode, DynamicData.List.IGrouping category) { Header = category.Key; Items = category.Items.Select(d => new NodeMenuItemViewModel(createNode, d)).ToList(); } public NodeMenuItemViewModel(ReactiveCommand createNode, NodeData nodeData) { Header = nodeData.Name; Subtitle = nodeData.Description; Items = new List(); CreateNode = ReactiveCommand.Create(() => { createNode.Execute(nodeData).Subscribe(); }); } public string Header { get; } public string? Subtitle { get; } public List Items { get; } public ReactiveCommand? CreateNode { get; } }