using Aitex.Common.Util; using Aitex.Core.RT.DataCenter; using Aitex.Core.Util; using MECF.Framework.Common.Beckhoff.Station; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MECF.Framework.Common.Beckhoff.AxisProvider { public class BeckhoffAxisProviderManager : Singleton { public Dictionary _axisProviderDic = new Dictionary(); /// /// 初始化 /// public void Initialize() { string xmlPath = PathManager.GetCfgDir() + "Devices\\AxisProviderCfg.xml"; BeckhoffAxisProviderCfg cfg= CustomXmlSerializer.Deserialize(new FileInfo(xmlPath)); if(cfg!=null) { foreach(BeckhoffProviderAxis item in cfg.Axes) { _axisProviderDic[item.Name] = item; DATA.Subscribe($"{item.Name}.AxisProvider", () => item, SubscriptionAttribute.FLAG.IgnoreSaveDB); } } } /// /// 获取AxisProvider /// /// /// public BeckhoffProviderAxis GetAxisProvider(string name) { return _axisProviderDic.ContainsKey(name) ? _axisProviderDic[name] : null; } } }