Files

63 lines
1007 B
C#

using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace AxCopilot.ViewModels;
public class PromptTemplateRow : INotifyPropertyChanged
{
private string _name = "";
private string _content = "";
private string _icon = "\ue8bd";
public string Name
{
get
{
return _name;
}
set
{
_name = value;
OnPropertyChanged("Name");
}
}
public string Content
{
get
{
return _content;
}
set
{
_content = value;
OnPropertyChanged("Content");
OnPropertyChanged("Preview");
}
}
public string Icon
{
get
{
return _icon;
}
set
{
_icon = value;
OnPropertyChanged("Icon");
}
}
public string Preview => (Content.Length > 60) ? (Content.Substring(0, 57).Replace("\n", " ") + "…") : Content.Replace("\n", " ");
public event PropertyChangedEventHandler? PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string? n = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(n));
}
}