Пример #1
0
        public TEMPChannelMapper LoadFromFile(string inXmlFileName = null)
        {
            //缺省参数处理
            if ((inXmlFileName == null) || (inXmlFileName == ""))
            {
                inXmlFileName = AppDomain.CurrentDomain.BaseDirectory + "TEMPMapping.config";
            }
            try
            {
                TEMPChannelMapper tmpDUTs = (TEMPChannelMapper)XmlHelper.LoadParameterFromXMLFile(typeof(TEMPChannelMapper), inXmlFileName);
                if (tmpDUTs == null)
                {
                    tmpDUTs = new TEMPChannelMapper();
                    tmpDUTs.RestoreDefault();
                }

                /*判断是否需要更新
                 * 更新条件为:
                 * 1.如果配置了最多的提供路数,以最多和仪表最大的提供能力为基础
                 * 2.如果全部配置,以仪表能力检查
                 *
                 * {
                 *
                 * }
                 * */

                return(tmpDUTs);
            }
            catch (Exception ex)
            {
                return(new TEMPChannelMapper());
            }
        }
Пример #2
0
 /// <summary>
 /// 拷贝 信息更新内存中当前对像信息(因为使用绑定,不能进行对像的替换)
 /// </summary>
 /// <param name="value"></param>
 public void Clone(TEMPChannelMapper value)
 {
     if ((this.TEMPChannelConfigList.Count != value.TEMPChannelConfigList.Count) || this.TEMPInstrumentList.Count != this.TEMPInstrumentList.Count)
     {
         throw new Exception("保存文件中电源映射详情信息有误,请检查信息");
     }
     for (int i = 0; i < this.TEMPChannelConfigList.Count; i++)
     {
         this.TEMPChannelConfigList[i].ChannelNoInDevice = value.TEMPChannelConfigList[i].ChannelNoInDevice;
         this.TEMPChannelConfigList[i].ConfiguredDCPower = value.TEMPChannelConfigList[i].ConfiguredDCPower;
         this.TEMPChannelConfigList[i].TEMPChannelName   = value.TEMPChannelConfigList[i].TEMPChannelName;
         this.TEMPChannelConfigList[i].TEMPDeviceName    = value.TEMPChannelConfigList[i].TEMPDeviceName;
         this.TEMPChannelConfigList[i].InstituteID       = value.TEMPChannelConfigList[i].InstituteID;
         this.TEMPChannelConfigList[i].Model             = value.TEMPChannelConfigList[i].Model;
     }
     //this.DCPowersCount = value.DCPowersCount;
     // throw new NotImplementedException();
 }