You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB
C#

using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace CommanderApp;
public class FileSystemItem : INotifyPropertyChanged
{
public string Name { get; set; } = string.Empty;
public string FullName { get; set; } = string.Empty;
public bool IsDirectory { get; set; }
private static string _padding = DefinePadding();
private static string DefinePadding()
{
return new string('\u00A0', 300);
}
public string DisplayText
{
get
{
if (string.IsNullOrWhiteSpace(Name))
return "[No Name]";
if (Name == "..")
return "⬆️ .." + _padding;
return IsDirectory ? $"📁 {Name + _padding}" : $"📄 {Name + _padding}";
}
}
private bool _isSelected;
public bool IsSelected
{
get => _isSelected;
set
{
_isSelected = value;
OnPropertyChanged();
}
}
public event PropertyChangedEventHandler? PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}