/// <summary> /// 加载测试参数数据 /// </summary> /// <param name="inXmlFileName">要加载的测试参数配置文件名,为空时从默认文件中加载</param> public InstrumentInfoList LoadParameterFromXMLFile(string inXmlFileName = null) { //缺省参数处理 if ((inXmlFileName == null) || (inXmlFileName == "")) { inXmlFileName = AppDomain.CurrentDomain.BaseDirectory + "SystemInstrument.config"; } try { InstrumentInfoList tmpDUTs = (InstrumentInfoList)XmlHelper.LoadParameterFromXMLFile(typeof(InstrumentInfoList), inXmlFileName); if (tmpDUTs == null) { tmpDUTs = new InstrumentInfoList(); } if (tmpDUTs.Count < 1) { tmpDUTs.RestoreDefaults(); } return(tmpDUTs); } catch (Exception) { return(new InstrumentInfoList()); } }
public static InstrumentInfoList getInstence() { if (_instrumentInfoList == null) { _instrumentInfoList = new InstrumentInfoList(); _instrumentInfoList = _instrumentInfoList.LoadParameterFromXMLFile(); } return(_instrumentInfoList); }
/// <summary> /// 拷贝 信息更新内存中当前对像信息(因为使用绑定,不能进行对像的替换) /// </summary> /// <param name="m_CurInstrumentInfoList"></param> public void Clone(InstrumentInfoList m_CurInstrumentInfoList) { foreach (InstrumentInfo instrumentInfo in m_CurInstrumentInfoList) { foreach (InstrumentInfo thisInstrument in this) { if (instrumentInfo.InstrumentTypeID == thisInstrument.InstrumentTypeID && (instrumentInfo.InstrumentTypeID != InstrumentType.DCPower || instrumentInfo.InstrumentTypeID != InstrumentType.DCPowerAnalyzer)) { //更新信息 // thisInstrument.CommentInfo = instrumentInfo.CommentInfo; thisInstrument.ConnectOK = instrumentInfo.ConnectOK; thisInstrument.DCModleNum = instrumentInfo.DCModleNum; thisInstrument.DevInfoState = instrumentInfo.DevInfoState; thisInstrument.Enabled = instrumentInfo.Enabled; thisInstrument.ErrorMsgs = instrumentInfo.ErrorMsgs; thisInstrument.Identity = instrumentInfo.Identity; thisInstrument.IDInInstitute = instrumentInfo.IDInInstitute; thisInstrument.InstrumentName = instrumentInfo.InstrumentName; thisInstrument.IpAddress = instrumentInfo.IpAddress; thisInstrument.Manufacter = instrumentInfo.Manufacter; thisInstrument.ModelNo = instrumentInfo.ModelNo; thisInstrument.OptionList = instrumentInfo.OptionList; thisInstrument.SN = instrumentInfo.SN; } } } for (int i = this.Count - 1; i >= 0; i--) { if (this[i].InstrumentTypeID == InstrumentType.DCPower || this[i].InstrumentTypeID == InstrumentType.DCPowerAnalyzer) { this.Remove(this[i]); } } //foreach (InstrumentInfo thisInstrument in this) //{ // if (thisInstrument.InstrumentTypeID == InstrumentType.DCPower || thisInstrument.InstrumentTypeID == InstrumentType.DCPowerAnalyzer) // { // this.Remove(thisInstrument); // } //} foreach (InstrumentInfo instrumentInfo in m_CurInstrumentInfoList) { if (instrumentInfo.InstrumentTypeID == InstrumentType.DCPower || instrumentInfo.InstrumentTypeID == InstrumentType.DCPowerAnalyzer) { this.Add(instrumentInfo); } } // throw new NotImplementedException(); }
public InstrumentInfoList GetInstrumentList(InstrumentType type) { InstrumentInfoList Result = new InstrumentInfoList(); foreach (InstrumentInfo tmpInstrumentInfo in this) { if (tmpInstrumentInfo.InstrumentTypeID == type) { Result.Add(tmpInstrumentInfo); } } return(Result); }
public InstrumentInfoList GetDCPowerInstrumentList() { InstrumentInfoList Result = new InstrumentInfoList(); foreach (InstrumentInfo tmpInstrumentInfo in this) { if (tmpInstrumentInfo.InstrumentTypeID == InstrumentType.DCPower || tmpInstrumentInfo.InstrumentTypeID == InstrumentType.DCPowerAnalyzer) { Result.Add(tmpInstrumentInfo); } } return(Result); }
public InstrumentInfoList GetToDetectInstrumentList(InstrumentType[] inToDetectDeviceType) { InstrumentInfoList Result = new InstrumentInfoList(); foreach (InstrumentInfo tmpInstrumentInfo in this) { foreach (InstrumentType tmpInstrumentType in inToDetectDeviceType) { if (tmpInstrumentInfo.InstrumentTypeID == tmpInstrumentType) { Result.Add(tmpInstrumentInfo); break; } } } return(Result); }