public void SetGroup(FrameGroup group) { if (group == null) { return; } // Attaching capture AttachmentVM capture = new AttachmentVM(new FileAttachment() { FileType = FileAttachment.Type.CAPTURE }); if (!String.IsNullOrEmpty(group.Name) && File.Exists(group.Name) && false) { capture.Attachment.Name = Path.GetFileName(group.Name); capture.Attachment.Data = new FileStream(group.Name, FileMode.Open); } else { capture.Attachment.Name = "Capture.opt"; capture.Attachment.Data = new MemoryStream(); Task.Run(() => { Application.Current.Dispatcher.Invoke(() => { capture.IsUploading = true; capture.Status = "Saving capture..."; }); group.Save(Capture.Create(capture.Attachment.Data)); Application.Current.Dispatcher.Invoke(() => { capture.IsUploading = false; capture.Status = String.Empty; capture.Size = capture.Attachment.Data.Length; }); }); } Attachments.Add(capture); // Attaching all the extracted attachments foreach (FileAttachment att in group.Summary.Attachments) { Attachments.Add(new AttachmentVM(att)); } }