private void UpdateTreeImagingObservation() { treeImagingObservation.SuspendLayout(); treeImagingObservation.Nodes.Clear(); ImagingObservationXML xmlImagingObservation = this.GetSelectedImagingObservation(); if (xmlImagingObservation.Node != null && xmlImagingObservation.imagingObservationCharacteristicCollectionXML.Exists && xmlImagingObservation.imagingObservationCharacteristicCollectionXML.First.ImagingObservationCharacteristicXML2.Exists) { int mainNodeIdx = GetTreeNodeIndex(mainTree, mainTree.SelectedNode); // if we're here, a node must be selected for (int i = 0; i < xmlImagingObservation.imagingObservationCharacteristicCollectionXML.First.ImagingObservationCharacteristicXML2.Count; i++) { ImagingObservationCharacteristicXML xmlImagingObsChar = xmlImagingObservation.imagingObservationCharacteristicCollectionXML.First.ImagingObservationCharacteristicXML2[i]; if (xmlImagingObsChar.codeMeaning.Exists) { TreeNode node = treeImagingObservation.Nodes.Add(xmlImagingObsChar.codeMeaning.First.Value); int nodeIdx = GetTreeNodeIndex(treeImagingObservation, node); if (this._selectedImagingObservations[mainNodeIdx].selectionIndecies.Contains(nodeIdx)) { node.Checked = true; } } } } treeImagingObservation.ResumeLayout(); treeImagingObservation.Update(); EventsHelper.Fire(SelectedImagingObservationChanged, this, EventArgs.Empty); }
public void GetSelectedValues(AIMOntology outputDoc) { AnnotationDescriptionXML xmlAnnotationDescription = outputDoc.AnnotationDescriptionXML2.Exists ? outputDoc.AnnotationDescriptionXML2.First : outputDoc.AnnotationDescriptionXML2.Append(); // Imaging Observation Collection imagingObservationCollectionXMLType xmlImagingObsCollection = xmlAnnotationDescription.imagingObservationCollectionXML.Exists ? xmlAnnotationDescription.imagingObservationCollectionXML.First : xmlAnnotationDescription.imagingObservationCollectionXML.Append(); foreach (ObservationSelection selectedValues in _selectedImagingObservations) { if (selectedValues.xmlImagingObservation.Node != null) { // Imaging Observation ImagingObservationXML xmlImagingObservation = xmlImagingObsCollection.ImagingObservationXML2.Append(); xmlImagingObservation.codeValue.Append().Value = selectedValues.xmlImagingObservation.codeValue.Exists ? selectedValues.xmlImagingObservation.codeValue.First.Value : string.Empty; xmlImagingObservation.codeMeaning.Append().Value = selectedValues.xmlImagingObservation.codeMeaning.Exists ? selectedValues.xmlImagingObservation.codeMeaning.First.Value : string.Empty; xmlImagingObservation.codingSchemeDesignator.Append().Value = selectedValues.xmlImagingObservation.codingSchemeDesignator.Exists ? selectedValues.xmlImagingObservation.codingSchemeDesignator.First.Value : string.Empty; xmlImagingObservation.comment.Append().Value = string.Empty; // no value for now // Imaging Observation Characteristic Collection imagingObservationCharacteristicCollectionXMLType xmlImgObsCharCollection = xmlImagingObservation.imagingObservationCharacteristicCollectionXML.Append(); if (selectedValues.xmlImagingObservation.imagingObservationCharacteristicCollectionXML.Exists) { imagingObservationCharacteristicCollectionXMLType oldXmlImagingObsCharCollection = selectedValues.xmlImagingObservation.imagingObservationCharacteristicCollectionXML.First; foreach (int selectedImgObsCharIndex in selectedValues.selectionIndecies) { // Check whether the selected imaging observation existed in the old (source) collection if (selectedImgObsCharIndex > -1 && selectedImgObsCharIndex < oldXmlImagingObsCharCollection.ImagingObservationCharacteristicXML2.Count) { // Imaging Observation Characteristic ImagingObservationCharacteristicXML oldXmlImagingObsChar = oldXmlImagingObsCharCollection.ImagingObservationCharacteristicXML2[selectedImgObsCharIndex]; ImagingObservationCharacteristicXML xmlImagingObsChar = xmlImgObsCharCollection.ImagingObservationCharacteristicXML2.Append(); xmlImagingObsChar.codeValue.Append().Value = oldXmlImagingObsChar.codeValue.Exists ? oldXmlImagingObsChar.codeValue.First.Value : string.Empty; xmlImagingObsChar.codeMeaning.Append().Value = oldXmlImagingObsChar.codeMeaning.Exists ? oldXmlImagingObsChar.codeMeaning.First.Value : string.Empty; xmlImagingObsChar.codingSchemeDesignator.Append().Value = oldXmlImagingObsChar.codingSchemeDesignator.Exists ? oldXmlImagingObsChar.codingSchemeDesignator.First.Value : string.Empty; xmlImagingObsChar.comment.Append().Value = string.Empty; // no value for now } } } } } }