private List <AnnotationInfo> GetAnnotationsForView(string view) { if (m_Annotations == null) { foreach (DataAttachment attachment in m_CaseObj.attachments.GetAnnotationsAttachments()) { m_Annotations = AnnotationsTranslator.TranslateXML(attachment.attachmentData); break; } } if (m_Annotations != null && m_Annotations.ContainsKey(view)) { return(m_Annotations[view]); } else { return(new List <AnnotationInfo>()); } }
public void Dispose() { _PxeAccess.Dispose(); AlgClientInstances.InstanceNumber--; m_HistogramDisplay.Dispose(); if (m_Annotations == null) { m_Annotations = new Dictionary <string, List <AnnotationInfo> >(); } else { m_Annotations.Clear(); } if (m_XrayImage != null) { foreach (XRayImage image in m_XrayImage) { if (!m_Annotations.ContainsKey(image.ViewName)) { List <Annotation> annots = image.GetAnnotations(); List <AnnotationInfo> infos = new List <AnnotationInfo>(); foreach (Annotation ann in annots) { infos.Add(new AnnotationInfo(ann.Marking.Rect.TopLeft, ann.Marking.Rect.Width, ann.Marking.Rect.Height, ann.Marking.RadiusX, ann.Marking.RadiusY, ann.CommentText)); } m_Annotations.Add(image.ViewName, infos); } } } if (Displays != null) { foreach (LayoutInfo layoutInfo in Displays) { UserControl1 userControl1 = layoutInfo.Display as UserControl1; if (userControl1 != null) { userControl1.Dispose(); } else { HistogramDisplay histogramDisplay = layoutInfo.Display as HistogramDisplay; if (histogramDisplay != null) { histogramDisplay.Dispose(); } } } Displays.Clear(); } DataAttachment dataAttachment = null; foreach (DataAttachment attachment in m_CaseObj.attachments.GetAnnotationsAttachments()) { dataAttachment = attachment; break; } if (dataAttachment == null) { dataAttachment = new DataAttachment(); dataAttachment.attachmentId = "Annotations.xml"; dataAttachment.attachmentType = AttachmentType.Annotations; dataAttachment.CreateTime = CultureResources.ConvertDateTimeToStringForData(DateTime.Now); } dataAttachment.attachmentData = (MemoryStream)AnnotationsTranslator.CreateXML(m_Annotations); dataAttachment.IsNew = true; m_CaseObj.NewAttachments.Add(dataAttachment); m_statusBarItems.StatusDisplay.Clear(); m_statusBarItems = null; m_CaseObj = null; }