コード例 #1
0
        /// <summary>取得檔案實體並載入所有點位資料</summary>
        /// <returns></returns>
        public static PositionInstance GetInstance()
        {
            ///<summary>設定點位內容集合資料</summary>
            Action <string, string> setDicPositionInfos = (positionFileName, deviceName) =>
            {
                var RobotPathConfigSetConfig = JSonHelper.GetInstanceFromJsonFile <List <RobotPathConfig> >(TransferRobotPathConfigSetConfigFile);
                var configDetail             = RobotPathConfigSetConfig.Where(m => m.DeviceName == deviceName).First().ConfigDetail;
                foreach (var config in configDetail)
                {
                    var key = positionFileName + config.PositionFileName;
                    List <PositionInfo> positions = default(List <PositionInfo>);
                    if (File.Exists(key))
                    {
                        positions = JSonHelper.GetInstanceFromJsonFile <List <PositionInfo> >(key);
                    }
                    _instance._dicPositionInfos.Add(key, positions);
                }
            };

            if (_instance == null)
            {
                lock (_lockObj)
                {
                    if (_instance == null)
                    {
                        _instance = new PositionInstance();
                        setDicPositionInfos(MTR_Path, MaskTransferRobotDeviceName);
                        setDicPositionInfos(BTR_Path, BoxTransferRobotDeviceName);
                    }
                }
            }
            return(_instance);
        }
コード例 #2
0
 /// <summary>重新取得檔案實體並重載所有點位資料</summary>
 public static void ReLoad()
 {
     _instance = null;
     Load();
 }
コード例 #3
0
 /// <summary>讀取特定移定路徑的所有點位資料</summary>
 /// <param name="pathFileName">移動路徑點位檔案</param>
 /// <returns></returns>
 public static List <PositionInfo> GetPositionPathPositionsFromJson(string pathFileName)
 {
     /** return GetInstanceFromJsonFile<List<PositionInfo>>(pathFileName);*/
     return(PositionInstance.GetInstance().GetPositionInfos(pathFileName));
 }