using Prism.Mvvm; using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ECMonitor.PlayerDraw.Code { /// /// 数据模型基类 /// [Serializable] public abstract class DataBase : BindableBase, INotifyPropertyChanged { public DataBase(string fileName) { string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Computer Madman"); if (!Directory.Exists(directory)) Directory.CreateDirectory(directory); DataPath = Path.Combine(directory, fileName); } [NonSerialized] string dataPath; /// /// 保存文件的路径 /// public string DataPath { get { return dataPath; } set { dataPath = value; } } /// /// 在更改属性值时发生。 /// public event PropertyChangedEventHandler PropertyChanged; /// /// 用于触发INotifyPropertyChanged的PropertyChanged事件 /// /// 属性名 protected void DataChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } private string _title = ""; public string Title { get { return _title; } set { SetProperty(ref _title, value); } } } }