public void InitializePages () { foreach (DataAttachment attachment in m_CaseObject.attachments.GetOCRAttachments()) { ImageInfo imgInfo = new ImageInfo(); MemoryStream ms = new MemoryStream(attachment.attachmentData.GetBuffer()); BitmapImage imageSource = new BitmapImage(); imageSource.BeginInit(); imageSource.StreamSource = ms; imageSource.EndInit(); imgInfo.imageSource = imageSource; imgInfo.FullName = attachment.attachmentId; imageFiles.Add(imgInfo); } }
//private Boolean m_ContainerIDChanged = false; public UserControl1 (CaseObject caseObj) { imageFiles = new List<ImageInfo>(); InitializeComponent(); CultureResources.registerDataProvider(this); foreach (DataAttachment attachment in caseObj.attachments.GetOCRAttachments()) { try { ImageInfo imgInfo = new ImageInfo(); MemoryStream ms = new MemoryStream(attachment.attachmentData.GetBuffer()); BitmapImage imageSource = new BitmapImage(); imageSource.BeginInit(); imageSource.StreamSource = ms; imageSource.CacheOption = BitmapCacheOption.None; imageSource.CreateOptions = BitmapCreateOptions.None; imageSource.EndInit(); imageSource.Freeze(); imgInfo.imageSource = imageSource; imgInfo.FullName = attachment.attachmentId; imageFiles.Add(imgInfo); } catch (Exception ex) { //TODO: Log Error that this is a bad file. } } m_CaseObject = caseObj; ContainerInfoArea.DataContext = m_CaseObject; if (!caseObj.IsCaseEditable) ContainerIDUpdateBtn.Visibility = System.Windows.Visibility.Collapsed; }