コード例 #1
0
        public DCChannelConfigMapper LoadFromFile(string inXmlFileName = null)
        {
            //缺省参数处理
            if ((inXmlFileName == null) || (inXmlFileName == ""))
            {
                inXmlFileName = AppDomain.CurrentDomain.BaseDirectory + "DCPowerMapping.config";
            }
            try
            {
                DCChannelConfigMapper tmpDUTs = (DCChannelConfigMapper)XmlHelper.LoadParameterFromXMLFile(typeof(DCChannelConfigMapper), inXmlFileName);
                if (tmpDUTs == null)
                {
                    tmpDUTs = new DCChannelConfigMapper();
                    tmpDUTs.RestoreDefault();
                }
                else
                {
                    int supplyDcNum = this.GetSupplyDcNum();
                    if (tmpDUTs.DCChannelConfigList.Count != supplyDcNum)
                    {
                        tmpDUTs = new DCChannelConfigMapper();
                        tmpDUTs.RestoreDefault();
                    }
                }

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

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