예제 #1
0
 public DCPowerChannelMapper LoadFromFile(string inXmlFileName)
 {
     //缺省参数处理
     if ((inXmlFileName == null) || (inXmlFileName == ""))
     {
         inXmlFileName = AppDomain.CurrentDomain.BaseDirectory + "DCPowerMapping.config";
     }
     try
     {
         DCPowerChannelMapper tmpDUTs = (DCPowerChannelMapper)XmlHelper.LoadParameterFromXMLFile(typeof(DCPowerChannelMapper), inXmlFileName);
         if (tmpDUTs == null)
         {
             tmpDUTs = new DCPowerChannelMapper();
             tmpDUTs.RestoreDefault();
         }
         if (tmpDUTs.m_DCPowerChannelInfos.Count() < 2)
         {
             tmpDUTs.RestoreDefault();
         }
         return(tmpDUTs);
     }
     catch (Exception ex)
     {
         return(new DCPowerChannelMapper());
     }
 }
예제 #2
0
 /// <summary>
 /// 拷贝 信息更新内存中当前对像信息(因为使用绑定,不能进行对像的替换)
 /// </summary>
 /// <param name="value"></param>
 public void Clone(DCPowerChannelMapper value)
 {
     if ((this.DCPowerChannelInfos.Length != value.DCPowerChannelInfos.Length) || this.DCPowerInstrumentList.Count != this.DCPowerInstrumentList.Count)
     {
         throw new Exception("保存文件中电源映射详情信息有误,请检查信息");
     }
     for (int i = 0; i < this.DCPowerChannelInfos.Length; i++)
     {
         this.DCPowerChannelInfos[i].ChannelNoInDevice  = value.DCPowerChannelInfos[i].ChannelNoInDevice;
         this.DCPowerChannelInfos[i].ConfiguredDCPower  = value.DCPowerChannelInfos[i].ConfiguredDCPower;
         this.DCPowerChannelInfos[i].DCPowerChannelName = value.DCPowerChannelInfos[i].DCPowerChannelName;
         this.DCPowerChannelInfos[i].DCPowerDeviceName  = value.DCPowerChannelInfos[i].DCPowerDeviceName;
         this.DCPowerChannelInfos[i].InstituteID        = value.DCPowerChannelInfos[i].InstituteID;
         this.DCPowerChannelInfos[i].Model = value.DCPowerChannelInfos[i].Model;
     }
     //this.DCPowersCount = value.DCPowersCount;
     // throw new NotImplementedException();
 }