public DisplayTopic(Topic topic) { BCFComment firstComment = topic.Markup.Comments.FirstOrDefault(); if (firstComment == null) { firstComment = new BCFComment(System.Guid.NewGuid(), topic.Markup.Topic.Guid, " ", DateTime.Now, " ", " "); } Guid = topic.Markup.Topic.Guid; Title = topic.Markup.Topic.Title; TopicType = topic.Markup.Topic.TopicType; Description = !String.IsNullOrEmpty(topic.Markup.Topic.Description) ? topic.Markup.Topic.Description : firstComment.Comment; Index = topic.Markup.Topic.Index; CreationDate = topic.Markup.Topic.CreationDate != null ? topic.Markup.Topic.CreationDate : firstComment.Date; CreationAuthor = !String.IsNullOrEmpty(topic.Markup.Topic.CreationAuthor) ? topic.Markup.Topic.CreationAuthor : firstComment.Author; ModifiedDate = topic.Markup.Topic.ModifiedDate != null ? topic.Markup.Topic.ModifiedDate: firstComment.ModifiedDate; ModifiedAuthor = !String.IsNullOrEmpty(topic.Markup.Topic.ModifiedAuthor) ? topic.Markup.Topic.ModifiedAuthor : firstComment.ModifiedAuthor; AssignedTo = topic.Markup.Topic.AssignedTo; TopicStatus = !String.IsNullOrEmpty(topic.Markup.Topic.TopicStatus) ? topic.Markup.Topic.TopicStatus: firstComment.Status; ImageSource = ""; if (topic.Snapshots.Count != 0) { byte[] snapshot = topic.Snapshots.First(kvp => kvp.Key.Contains("snapshot")).Value; if (snapshot != null) { ImageSource = Services.BCFServices.GetImageFromBytes(snapshot, true); } else { ImageSource = Services.BCFServices.GetImageFromBytes(topic.Snapshots.FirstOrDefault().Value, true); } } }
public static MarkupXMLFile BuildMarkupObject() { MarkupXMLFile xmlObj = new MarkupXMLFile(); BCFComment comment = new BCFComment(Guid.NewGuid(), Guid.NewGuid(), "testStatus", DateTime.Now, "testAuthor", "testComment"); comment.ModifiedAuthor = "testModifiedAuthor"; comment.ModifiedDate = DateTime.Now; comment.ReplyToComment = new AttrIDNode(Guid.NewGuid()); comment.Viewpoint = new AttrIDNode(Guid.NewGuid()); comment.VerbalStatus = "testVerbalStatus"; xmlObj.Comments.Add(comment); BCFViewpoint viewp = new BCFViewpoint(Guid.NewGuid()); viewp.Snapshot = "testSnapshot.png"; viewp.Viewpoint = "testFilename.bcfv"; xmlObj.Viewpoints.Add(viewp); xmlObj.Header = new BCFHeader(); BCFFile f = new BCFFile(); f.Date = DateTime.Now; f.Filename = "testFilename"; f.IfcProject = "IfcGuid______________1"; f.IfcSpatialStructureElement = "IfcGuid______________1"; f.isExternal = false; f.Reference = "testReference"; xmlObj.Header.Files.Add(f); xmlObj.Topic = new BCFTopic(Guid.NewGuid(), "testTitle"); xmlObj.Topic.AssignedTo = "testAssignedTo"; xmlObj.Topic.BimSnippet = new BCFBimSnippet("testSnippetType", "testReference"); xmlObj.Topic.BimSnippet.isExternal = true; xmlObj.Topic.BimSnippet.ReferenceSchema = "testReferenceSchema"; return(xmlObj); }