using System.Collections.ObjectModel; using CommunityToolkit.Mvvm.ComponentModel; namespace S7Explorer.Models { // Base class for all project items public class ProjectItem : ObservableObject { private string _name = string.Empty; private string _path = string.Empty; private ProjectItem? _parent; private ObservableCollection _children = new(); private bool _isExpanded; private bool _isSelected; public string Name { get => _name; set => SetProperty(ref _name, value); } public string Path { get => _path; set => SetProperty(ref _path, value); } public ProjectItem? Parent { get => _parent; set => SetProperty(ref _parent, value); } public ObservableCollection Children { get => _children; set => SetProperty(ref _children, value); } public bool IsExpanded { get => _isExpanded; set => SetProperty(ref _isExpanded, value); } public bool IsSelected { get => _isSelected; set => SetProperty(ref _isSelected, value); } public virtual object? GetDetailsObject() { return null; } public virtual string GetIcon() { return "FolderClosed"; } public virtual string GetExportText() { return $"Item: {Name}\r\n"; } public override string ToString() { return Name; } } }