Example #1
0
        /// <summary> Fills the details of the selected Topic in the list view and the image </summary>
        /// <param name="markup">Selected Topic</param>
        private void ShowTopicDetails(BCFmarkup.Markup markup)
        {
            list.Clear();
            list.Columns.Add("TOPIC", -1, HorizontalAlignment.Left);
            list.Columns.Add("", -1, HorizontalAlignment.Left);
            AddProperty("Title", markup.Topic.Title);
            AddProperty("Description", markup.Topic.Description);
            AddProperty("Topic Type", markup.Topic.TopicType);
            AddProperty("Topic Status", markup.Topic.TopicStatus);
            AddProperty("Topic Index", markup.Topic.Index.ToString());
            String tags = "";

            foreach (string label in markup.Topic.Labels)
            {
                tags += label + " ";
            }
            tags = tags.Trim();
            AddProperty("Topic Labels", tags);
            AddProperty("Creation Date", formatDate(markup.Topic.CreationDate));
            AddProperty("Creation Author", markup.Topic.CreationAuthor);
            if (markup.Topic.ModifiedAuthor != null && markup.Topic.ModifiedDate != null)
            {
                if (markup.Topic.ModifiedAuthor != markup.Topic.CreationAuthor || markup.Topic.ModifiedDate != markup.Topic.ModifiedDate)
                {
                    AddProperty("Modified Date", formatDate(markup.Topic.ModifiedDate));
                    AddProperty("Modified Author", markup.Topic.ModifiedAuthor);
                }
            }
            AddProperty("Due Date", (markup.Topic.DueDate.Equals(DateTime.MinValue) ? "Unset" : formatDate(markup.Topic.DueDate)));
            AddProperty("Assigned to", markup.Topic.AssignedTo);
            AddProperty("Stage", markup.Topic.Stage);
            int cc = markup.Comment.Count;

            AddProperty("Comments", cc > 0 ? cc.ToString() + " comment" + (cc > 1 ? "s" : "") : "None");
            int vc = markup.Viewpoints.Count;

            AddProperty("Viewpoints", vc > 0 ? vc.ToString() + " viewpoint" + (vc > 1 ? "s" : "") : "None");
            // Viewpoint
            if (vc > 0)
            {
                BCFmarkup.ViewPoint vp = markup.Viewpoints[0];
                // Viewpoint-Image
                if (vp.Image != null)
                {
                    pict.Image = vp.Image;
                    ratio      = (double)vp.Image.Height / (double)vp.Image.Width;
                }
                else // No Image
                {
                    pict.Image = null;
                    ratio      = 0.0;
                }
            }
            else // No viewpoint -> No Image
            {
                pict.Image = null;
                ratio      = 0.0;
            }
            ResizeImage();
        }
Example #2
0
        /// <summary> Add a Topic in the tree </summary>
        /// <param name="parent">File owning this topic</param>
        /// <param name="topic">Topic to be added in tree</param>
        private BCFTreeNode AddTopic(BCFTreeNode parent, BCFmarkup.Markup topic)
        {
            BCFTreeNode tn = new BCFTreeNode();

            tn.Text        = topic.Topic.Title;
            tn.NodeFile    = null;
            tn.NodeTopic   = topic;
            tn.NodeComment = null;
            parent.Nodes.Add(tn);
            return(tn);
        }
Example #3
0
 /// <summary> Load a BCF File </summary>
 /// <param name="FileName">Full path of the file to be loadded or appended </param>
 /// <returns>Nothing</returns>
 public void ReadBCF(String FileName)
 {
     FullName = FileName;
     MarkupsList.Clear();
     using (bcfzip = ZipFile.OpenRead(FileName)) {
         ReadFile();
         foreach (ZipArchiveEntry entry in bcfzip.Entries)
         {
             if (entry.FullName.EndsWith("markup.bcf", StringComparison.OrdinalIgnoreCase))
             {
                 string           folder     = entry.FullName.Substring(0, entry.FullName.LastIndexOf("/") + 1);
                 XmlSerializer    serializer = new XmlSerializer(typeof(BCFmarkup.Markup));
                 BCFmarkup.Markup markup     = (BCFmarkup.Markup)serializer.Deserialize(new XmlTextReader(entry.Open()));
                 MarkupsList.Add(markup);
                 // Search for Viewpoints for Version 2.0
                 foreach (BCFmarkup.ViewPoint vp in markup.Viewpoints)
                 {
                     vp.Bcfv  = ReadBCFV(folder + vp.Viewpoint);
                     vp.Image = ReadSnapshot(folder + vp.Snapshot);
                 }
                 // If Viewpoints is empty, try Version 1.0 : viewpoint.bcfv files.
                 if (markup.Viewpoints.Count == 0 && bcfzip.GetEntry(folder + "viewpoint.bcfv") != null)
                 {
                     // Found viewpoint.bcfv !
                     BCFmarkup.ViewPoint NewViewpoint = new BCFmarkup.ViewPoint();
                     NewViewpoint.Guid      = "viewpointbcfv"; // pseudo GUID
                     NewViewpoint.Viewpoint = "viewpoint.bcfv";
                     NewViewpoint.Snapshot  = "snapshot.png";
                     NewViewpoint.Bcfv      = ReadBCFV(folder + NewViewpoint.Viewpoint);
                     NewViewpoint.Image     = ReadSnapshot(folder + NewViewpoint.Snapshot);
                     if (NewViewpoint.Image == null)
                     {
                         NewViewpoint.Snapshot = null;              // Image not found !
                     }
                     markup.Viewpoints.Add(NewViewpoint);
                 }
                 foreach (BCFmarkup.Comment com in markup.Comment)
                 {
                     if (com.Viewpoint != null)
                     {
                         foreach (BCFmarkup.ViewPoint vp in markup.Viewpoints)
                         {
                             if (vp.Guid == com.Viewpoint.Guid)
                             {
                                 com.MarkupViewPoint = vp;
                             }
                         }
                     }
                 }
             } // Endif markup
         }     // Next entry
     }         // End using
 }
Example #4
0
        private void pict_DoubleClick(Object sender, EventArgs args)
        {
            BCFmarkup.ViewPoint v  = null;
            BCFTreeNode         tn = (BCFTreeNode)tree.SelectedNode;

            if (tn == null)
            {
                return;
            }
            if (tn.NodeTopic != null)
            {
                BCFmarkup.Markup topic = tn.NodeTopic;
                if (topic.Viewpoints.Count > 0)
                {
                    v = topic.Viewpoints[0];
                }
            }
            else if (tn.NodeComment != null)
            {
                BCFmarkup.Comment comment = tn.NodeComment;
                if (comment.Viewpoint != null)
                {
                    v = comment.MarkupViewPoint;
                }
                else
                {
                    BCFTreeNode      tp    = (BCFTreeNode)tree.SelectedNode.Parent;
                    BCFmarkup.Markup topic = tp.NodeTopic;
                    if (topic.Viewpoints.Count > 0)
                    {
                        v = topic.Viewpoints[0];
                    }
                }
            }
            if (v != null)
            {
                if (v.Bcfv.CameraDefined())
                {
                    if (MoveCamera != null)
                    {
                        MoveCamera(v.Bcfv);
                    }
                    else
                    {
                        MessageBox.Show(v.Bcfv.CameraText(), "Camera:");
                    }
                }
            }
        }
Example #5
0
 /// <summary> Fills the details of the selected Comment in the list view and the image </summary>
 /// <param name="comment">Selected Comment</param>
 /// <param name="topic">Topic parent of the Comment</param>
 private void ShowCommentDetails(BCFmarkup.Markup topic, BCFmarkup.Comment comment)
 {
     list.Clear();
     list.Columns.Add("COMMENT", -1, HorizontalAlignment.Left);
     list.Columns.Add("", -1, HorizontalAlignment.Left);
     AddProperty("Comment", comment.CommentProperty);
     AddProperty("Creation Date", formatDate(comment.Date));
     AddProperty("Creation Author", comment.Author);
     if (comment.ModifiedAuthor != null && comment.ModifiedDate != null)
     {
         if (comment.ModifiedAuthor != comment.Author || comment.ModifiedDate != comment.Date)
         {
             AddProperty("Modified Date", formatDate(comment.ModifiedDate));
             AddProperty("Modified Author", comment.ModifiedAuthor);
         }
     }
     AddProperty("Viewpoint", (comment.Viewpoint != null ? "Yes" : "No"));
     // Viewpoint
     BCFmarkup.ViewPoint vp = null;
     if (comment.Viewpoint != null)
     {
         vp = comment.MarkupViewPoint;
     }
     else if (topic.Viewpoints.Count > 0)
     {
         vp = topic.Viewpoints[0];
     }
     if (vp != null) // Viewpoint-Image
     {
         if (vp.Image != null)
         {
             pict.Image = vp.Image;
             ratio      = (double)vp.Image.Height / (double)vp.Image.Width;
             ResizeImage();
         }
         else // No Image
         {
             pict.Image = null;
         }
     }
 }