using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; namespace CtrEditor.Models { public class ImageData : INotifyPropertyChanged { private string _customName; private List _tags; public string FileName { get; set; } public string CustomName { get => _customName; set { _customName = value; OnPropertyChanged(); } } public List Tags { get => _tags ?? new List(); set { _tags = value; OnPropertyChanged(); } } public string DisplayName => !string.IsNullOrEmpty(CustomName) ? CustomName : FileName; public ImageData() { FileName = string.Empty; _customName = string.Empty; _tags = new List(); } public ImageData(string fileName, string customName = null, List tags = null) { FileName = fileName; _customName = customName ?? string.Empty; _tags = tags ?? new List(); } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }