using AddInPlugin; using OpenTap.Addin; using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using UtilLib; namespace OpenTapEditor { public class UIStationGlobalsManager : DefaultStationGlobalsManager, INotifyPropertyChanged { public static UIStationGlobalsManager Instance { get; } = new UIStationGlobalsManager(); public event PropertyChangedEventHandler PropertyChanged; private ObservableCollection datasource; public ObservableCollection Datasource { get { return datasource; } set { datasource = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Datasource))); } } private UIStationGlobalsManager() { ReadFromLocal(); } public IEnumerable ReadFromLocal() { if (Datasource == null) { string path = Path.Combine(GetRegister(), "Config", "StationGlobals.data"); if (!File.Exists(path)) { Datasource = new ObservableCollection(); } else { Datasource = XmlHelper.DeserializeFromXml>(path); } } return Datasource; } } }