/// <summary> /// Update the list of Comments in the locally held reportObject /// </summary> public void ExportReportComments() { if (this._isCommentLoadingComplete == false) { return; } this._reportObject.Comments = new List <SiliconStudio.Meet.EjpLib.BaseClasses.ejpCAComment>(); foreach (ReportCommentAdorner a in this._commentAdorners) { EjpLib.BaseClasses.ejpCAComment com = new EjpLib.BaseClasses.ejpCAComment() { AuthorId = a.Comment.OriginalAuthorId, AuthorName = a.Comment.OriginalAuthorName, CommentId = a.Comment.CommentId, OriginalPositionX = a.Comment.OriginalCoordinates.X, OriginalPositionY = a.Comment.OriginalCoordinates.Y, PositionX = 0, PositionY = 0, CommentedTextInDocument = a.Comment.CommentTextInDocument }; if (com.Messages == null) { com.Messages = new List <SiliconStudio.Meet.EjpLib.BaseClasses.ejpCACommentMessage>(); } foreach (CommentMessage item in a.Comment.Messages) { com.Messages.Add( new SiliconStudio.Meet.EjpLib.BaseClasses.ejpCACommentMessage() { Author = item.Author, AuthorId = item.AuthorId, Message = item.Message, Date = item.Date } ); } this._reportObject.Comments.Add(com); } }
private void ImportComment(EjpLib.BaseClasses.ejpCAComment comment) { TextPointer commentStart = this._textArea.GetPositionFromPoint( new Point(comment.OriginalPositionX, comment.OriginalPositionY), true); TextPointer commentEnd = commentStart.GetPositionAtOffset(comment.CommentedTextInDocument.Length); TextRange range = new TextRange(commentStart, commentEnd); range.ApplyPropertyValue(TextElement.BackgroundProperty, new SolidColorBrush(Color.FromArgb(80, 0, 255, 0))); ReportCommentAdorner comAd = new ReportCommentAdorner( this._textArea, commentStart, commentEnd, comment.AuthorName, comment.AuthorId, comment.Messages, comment.CommentId); AdornerLayer commentAdornerLayer = AdornerLayer.GetAdornerLayer(this._textArea); comAd.OnCommentAdornerDeleted += new CommentAdornerDeleted(OnCommentAdornerDeleted); commentAdornerLayer.Add(comAd); this._commentAdorners.Add(comAd); }
private bool ImportComment(EjpLib.BaseClasses.ejpCAComment comment) { TextPointer commentStart = this._textArea.Document.ContentStart.GetPositionAtOffset(Math.Abs((int)comment.OriginalPositionX)); if (commentStart == null) { return(false); } TextPointer commentEnd = commentStart.GetPositionAtOffset(Math.Abs((int)comment.OriginalPositionY)); if (commentEnd == null) { return(false); } Point commmentInsertPoint = commentStart.GetCharacterRect(LogicalDirection.Forward).TopLeft; KnowledgeMapComment commentToAdd = new KnowledgeMapComment() { OriginalAuthorId = comment.AuthorId, OriginalAuthorName = comment.AuthorName, CurrentAuthorId = this.CurrentOwnerId, CurrentAuthorName = this.CurrentOwnerName, CommentId = comment.CommentId, Width = 200, Height = 300, CommentTextInDocument = comment.CommentedTextInDocument, OriginalCoordinates = new Point(comment.OriginalPositionX, comment.OriginalPositionY), CommentedTextStart = commentStart }; commentToAdd.DisableReturnToOriginalPosition(); foreach (EjpLib.BaseClasses.ejpCACommentMessage message in comment.Messages) { commentToAdd.Messages.Add( new CommentMessage() { Author = message.Author, AuthorId = message.AuthorId, Date = message.Date, Message = message.Message } ); } this._c_FakeAdornerLayer.Children.Add(commentToAdd); Point p = commentToAdd.CommentedTextStart.GetCharacterRect( LogicalDirection.Forward).TopLeft; if (((p.Y - 10) + 300) < this._c_FakeAdornerLayer.ActualHeight) { Canvas.SetTop(commentToAdd, p.Y - 10); } else { Canvas.SetTop(commentToAdd, (p.Y - 10) - 300); } if ((p.X + 200) < this._c_FakeAdornerLayer.ActualWidth) { Canvas.SetLeft(commentToAdd, p.X); } else { Canvas.SetLeft(commentToAdd, p.X - 178); } commentToAdd.OnDeleteComment += new DeleteKnowledgeMapComment(comment_OnDeleteComment); commentToAdd.OnMinimizeComment += new KnowledgeMapCommentViewStateChanged(comment_OnMinimizeComment); commentToAdd.OnMaximizeComment += new KnowledgeMapCommentViewStateChanged(comment_OnMaximizeComment); //this._comments.Add(commentToAdd); //090126 Rect tStartRect = commentStart.GetCharacterRect(LogicalDirection.Forward); Rect tEndRect = commentEnd.GetCharacterRect(LogicalDirection.Forward); DrawingBrush lineHandleSBrush = this.Resources["commentLineHandleS_default"] as DrawingBrush; DrawingBrush lineHandleEBrush = this.Resources["commentLineHandleE_default"] as DrawingBrush; commentToAdd.StartHandleRectangle = new Rectangle() { Fill = lineHandleSBrush }; commentToAdd.StartHandleRectangle.Width = 9; commentToAdd.StartHandleRectangle.Height = (tStartRect.Height < 5) ? 10 : tStartRect.Height;; commentToAdd.EndHandleRectangle = new Rectangle() { Fill = lineHandleEBrush }; commentToAdd.EndHandleRectangle.Width = 9; commentToAdd.EndHandleRectangle.Height = (tEndRect.Height < 5) ? 10 : tEndRect.Height; commentToAdd.StartHandleRectangle.SetValue(Canvas.TopProperty, tStartRect.TopLeft.Y); commentToAdd.StartHandleRectangle.SetValue(Canvas.LeftProperty, tStartRect.TopLeft.X); commentToAdd.EndHandleRectangle.SetValue(Canvas.TopProperty, tEndRect.TopLeft.Y); commentToAdd.EndHandleRectangle.SetValue(Canvas.LeftProperty, tEndRect.TopLeft.X); this._c_FakeAdornerLayer.Children.Insert(0, commentToAdd.StartHandleRectangle); this._c_FakeAdornerLayer.Children.Insert(0, commentToAdd.EndHandleRectangle); this._comments.Add(commentToAdd); return(true); }
private void ImportComment(EjpLib.BaseClasses.ejpCAComment comment) { TextPointer commentStart = this._textArea.GetPositionFromPoint( new Point(comment.OriginalPositionX, comment.OriginalPositionY), true); TextPointer commentEnd = commentStart.GetPositionAtOffset(comment.CommentedTextInDocument.Length); KnowledgeMapComment commentToAdd = new KnowledgeMapComment() { OriginalAuthorId = comment.AuthorId, OriginalAuthorName = comment.AuthorName, CurrentAuthorId = this.CurrentOwnerId, CurrentAuthorName = this.CurrentOwnerName, CommentId = comment.CommentId, Width = 200, Height = 300, CommentTextInDocument = comment.CommentedTextInDocument, OriginalCoordinates = new Point(comment.OriginalPositionX, comment.OriginalPositionY), CommentedTextStart = commentStart }; commentToAdd.DisableReturnToOriginalPosition(); foreach (EjpLib.BaseClasses.ejpCACommentMessage message in comment.Messages) { commentToAdd.Messages.Add( new CommentMessage() { Author = message.Author, AuthorId = message.AuthorId, Date = message.Date, Message = message.Message } ); } this._c_FakeAdornerLayer.Children.Add(commentToAdd); Point p = commentToAdd.CommentedTextStart.GetCharacterRect( LogicalDirection.Forward).TopLeft; if (((p.Y - 10) + 300) < this._c_FakeAdornerLayer.ActualHeight) { Canvas.SetTop(commentToAdd, p.Y - 10); } else { Canvas.SetTop(commentToAdd, (p.Y - 10) - 300); } if ((p.X + 200) < this._c_FakeAdornerLayer.ActualWidth) { Canvas.SetLeft(commentToAdd, p.X); } else { Canvas.SetLeft(commentToAdd, p.X - 178); } commentToAdd.OnDeleteComment += new DeleteKnowledgeMapComment(comment_OnDeleteComment); commentToAdd.OnMinimizeComment += new KnowledgeMapCommentViewStateChanged(comment_OnMinimizeComment); commentToAdd.OnMaximizeComment += new KnowledgeMapCommentViewStateChanged(comment_OnMaximizeComment); this._comments.Add(commentToAdd); }