private void InitTestStationList() { testEquipmentListControl.DataObjectName = "ItemDescriptionReference"; testEquipmentListControl.DataObjectFormType = typeof(ItemDescriptionReferenceForm); testEquipmentListControl.AddColumnData("Equipment", "ToString()", 1.00); testEquipmentListControl.InitColumns(); testEquipmentListControl.CompletedAdd += testStationListControl_CompletedAdd; testEquipmentListControl.CompletedEdit += testStationListControl_CompletedEdit; testEquipmentListControl.CompletedDelete += testStationListControl_CompletedDelete; testEquipmentListControl.SelectedIndexChanged += testStationListControl_SelectedIndexChanged; testEquipmentListControl.OnFind += testStationListControl_OnFind; testEquipmentListControl.ShowFind = true; testEquipmentListControl.InitializeForm += delegate(Form form) { var itemReferenceForm = form as ItemDescriptionReferenceForm; if (itemReferenceForm != null) { ItemDescriptionReference itemRef = itemReferenceForm.ItemDescriptionReference; if (!(itemRef is TestConfigurationTestEquipmentItem)) { itemReferenceForm.ItemDescriptionReference = new TestConfigurationTestEquipmentItem(); itemReferenceForm.ItemDescriptionReference.Item = itemRef.Item; } itemReferenceForm.DocumentType = dbDocument.DocumentType.TEST_STATION_DESCRIPTION; } }; }
private void AddUutDocumentReference(ItemDescriptionReference idr) { string model = ""; string partNo = ""; var id = idr.Item as DocumentReference; if (id != null) { Document document = DocumentManager.GetDocument(id.uuid); if (document != null) { string content = StringUtils.RemoveByteOrderMarkUTF8(Encoding.UTF8.GetString(document.DocumentContent)); UUTDescription uut = UUTDescription.Deserialize(content); if (uut != null) { model = GetIdentity(uut.Item, model, ref partNo); } var lvi = new ListViewItem(model); lvi.SubItems.Add(partNo); lvi.SubItems.Add(id.uuid); lvi.Tag = idr; uutListControl.Items.Add(lvi); } } }
public static String toATML(CASS_MTPSI tpsi) { StringWriter tw = new StringWriter(); TestConfiguration testConfig = new TestConfiguration(); ManufacturerData configManager = testConfig.ConfigurationManager; List <CASS_MTPSICASS_MTPSI_page> pages = tpsi.CASS_MTPSI_page; foreach (CASS_MTPSICASS_MTPSI_page page in pages) { CASS_MTPSICASS_MTPSI_pageUUT uut = page.UUT; String partNo = uut.UUT_ID.Part_Number; //UUTInstance instance = new UUTInstance(); UUTDescription item = new UUTDescription(); //item.Item.name = uut.UUT_ID.Part_Number; //Lookup UUT Information ItemDescriptionReference reference = new ItemDescriptionReference(); DocumentReference docRef = new DocumentReference(); //docRef.ID = uut.UUT_ID.Part_Number; docRef.uuid = "{SOMEUUIDHERE}"; reference.Item = docRef;// item.Item; //testConfig.TestedUUTs.Add(reference); TestConfigurationTestEquipmentItem testEquipment = new TestConfigurationTestEquipmentItem(); foreach (CASS_MTPSICASS_MTPSI_pageATE_assets asset in page.ATE_assets) { ItemDescriptionReference refEquip = new ItemDescriptionReference(); ItemDescription instrument = new ItemDescription(); instrument.name = asset.Asset_Identifier; refEquip.Item = instrument; //testEquipment.Instrumentation.Add(refEquip); } // testConfig.TestEquipment.Add(testEquipment); try { XmlSerializer serializerObj = new XmlSerializer(typeof(TestConfiguration)); serializerObj.Serialize(tw, testConfig); } catch (Exception e) { Exception ie = e.InnerException; while (ie != null) { Trace.WriteLine(ie.Message); ie = ie.InnerException; } } break; } return(tw.ToString()); }
protected virtual void ControlsToData() { if (_itemDescriptionReference == null) { _itemDescriptionReference = new ItemDescriptionReference(); } if (rbDocumentReference.Checked) { _itemDescriptionReference.Item = documentReferenceControl.DocumentReference; } else if (rbDefinition.Checked) { _itemDescriptionReference.Item = itemDescriptionControl.ItemDescription; } }
public static UUTDescription FindUut(ItemDescriptionReference uutReference) { UUTDescription uut = null; string uuid; if (uutReference != null && uutReference.Item is DocumentReference) { uuid = ((DocumentReference)uutReference.Item).uuid; Document document = DocumentManager.GetDocument(uuid); if (document != null && document.DocumentContent != null) { uut = UUTDescription.Deserialize(Encoding.UTF8.GetString(document.DocumentContent)); } } return(uut); }
private void AddUutDocumentReference(UUTDescription uut) { var docRef = new DocumentReference(); var document = DocumentManager.GetDocument(uut.uuid); docRef.ID = "UUT" + uutListControl.Items.Count + 1; docRef.uuid = uut.uuid; docRef.DocumentType = document.DocumentType; docRef.DocumentContent = document.DocumentContent; docRef.ContentType = document.ContentType; docRef.DocumentName = document.name; var idr = new ItemDescriptionReference { Item = docRef }; uutListControl.AddListViewObject(idr); }
private void AddItemDescription(ItemDescriptionReference idr) { string partNo = ""; var id = idr.Item as ItemDescription; if (id != null) { var lvi = new ListViewItem(id.Identification != null ? id.Identification.ModelName : ""); if (id.Identification != null && id.Identification.IdentificationNumbers != null && id.Identification.IdentificationNumbers.Count > 0) { partNo = id.Identification.IdentificationNumbers[0].number; } lvi.SubItems.Add(partNo); lvi.SubItems.Add(id.name); lvi.Tag = idr; uutListControl.Items.Add(lvi); } }
public static void CreateProject(ProjectInfo projectInfo) { //--- Prompt for a test set name ---// //--- Check if the name exisists ---// //--- If name exists then notify the user, ask if they want to open that test set ---// //--- Otherwise create the test set and open it ---// if (projectInfo != null) { TestProgramSet currentTestProgramSet = TestProgramSet.CreateTestSet(projectInfo.ProjectName); if (currentTestProgramSet != null) { SaveProjectInfo(projectInfo, currentTestProgramSet); OpenProject(projectInfo.ProjectName); Document uutDescriptionDocument = DocumentManager.GetDocument(projectInfo.UutId); if (uutDescriptionDocument != null) { SaveATMLDocument(UutManager.BuildAtmlFileName(projectInfo.UutName), AtmlFileType.AtmlTypeUut, uutDescriptionDocument.DocumentContent); } //--- Create a Test Description ---// if (uutDescriptionDocument != null) { var uutDoc = new DocumentReference(); uutDoc.ID = "UUT1"; uutDoc.uuid = uutDescriptionDocument.uuid; var uutRef = new ItemDescriptionReference(); uutRef.Item = uutDoc; var testConfiguration = new TestConfiguration15(); testConfiguration.uuid = Guid.NewGuid().ToString(); testConfiguration.TestedUUTs.Add(uutRef); SaveATMLDocument(projectInfo.ProjectName + ATMLContext.ATML_CONFIG_FILENAME_SUFFIX, AtmlFileType.AtmlTypeTestConfiguration, Encoding.UTF8.GetBytes(testConfiguration.Serialize())); } } } }
protected virtual void ControlsToData() { if (_configurationSoftwareReference == null) { _configurationSoftwareReference = new ConfigurationSoftwareReference(); } if (_configurationSoftwareReference != null) { ItemDescriptionReference itemRef = itemDescriptionReferenceControl.ItemDescriptionReference; _configurationSoftwareReference.Item = itemRef.Item; _configurationSoftwareReference.Checksum = checkSumControl.Checksum; _configurationSoftwareReference.ItemRef = edtItemRef.GetValue <string>(); _configurationSoftwareReference.type = edtType.GetValue <string>(); _configurationSoftwareReference.Documentation = documentControl.Document; if (_configurationSoftwareReference.Documentation != null && string.IsNullOrEmpty(_configurationSoftwareReference.Documentation.uuid) && string.IsNullOrEmpty(_configurationSoftwareReference.Documentation.name) && string.IsNullOrEmpty(_configurationSoftwareReference.Documentation.Item) ) { _configurationSoftwareReference.Documentation = null; } } }