using FLY.IntegratedControl.UI.Client.UIModule; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace FLY.IntegratedControl.UI.Client { public class SysParam : Misc.ISaveToXml, INotifyPropertyChanged { static SysParam current; public static SysParam Current { get { if (current == null) { current = new SysParam(); } return current; } } #region 属性,成员变量的代理 public IPEndPoint ServerEP { get; set; } public IBCCtrlGraphParams GraphParams { get; } = new IBCCtrlGraphParams(); public string Path = "ibcparam.xml"; #endregion static SysParam() { Misc.SaveToXmlHepler.Regist(typeof(IBCCtrlGraphParams)); } public SysParam() { ServerEP = Misc.StringConverter.ToIPEndPoint("127.0.0.1:20003"); if (!Load()) Save(); this.PropertyChanged += SysParam_PropertyChanged; } private void SysParam_PropertyChanged(object sender, PropertyChangedEventArgs e) { } public bool Load() { return Misc.SaveToXmlHepler.Load(Path, this); } public void Save() { Misc.SaveToXmlHepler.Save(Path, this); } public string[] GetSavePropertyNames() { return new string[]{ "ServerEP", "GraphParams" }; } public event PropertyChangedEventHandler PropertyChanged; } }