ShortcutsHelper/Models/ShortcutRecord.cs

89 lines
2.2 KiB
C#

using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace ShortcutsHelper.Models
{
public class ShortcutRecord : INotifyPropertyChanged
{
private string _application = "";
private string _shortcut = "";
private string _description = "";
private bool _isFavorite = false;
private bool _isModified = false;
public string Application
{
get => _application;
set
{
if (_application != value)
{
_application = value;
OnPropertyChanged();
}
}
}
public string Shortcut
{
get => _shortcut;
set
{
if (_shortcut != value)
{
_shortcut = value;
IsModified = true;
OnPropertyChanged();
}
}
}
public string Description
{
get => _description;
set
{
if (_description != value)
{
_description = value;
IsModified = true;
OnPropertyChanged();
}
}
}
public bool IsFavorite
{
get => _isFavorite;
set
{
if (_isFavorite != value)
{
_isFavorite = value;
IsModified = true;
OnPropertyChanged();
}
}
}
public bool IsModified
{
get => _isModified;
set
{
if (_isModified != value)
{
_isModified = value;
OnPropertyChanged();
}
}
}
public event PropertyChangedEventHandler? PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}