/// <summary> /// Handles the IsCommentSelectedChanged event of CommentControl object. /// </summary> private void CommentControl_IsCommentSelectedChanged(object sender, PropertyChangedEventArgs <bool> e) { #if !REMOVE_ANNOTATION_PLUGIN if (CommentTool != null) { // get comment control ICommentControl control = CommentTool.FindCommentControl(((CommentControl)sender).Comment); // if comment control is found if (control != null) { // if comment must be selected if (e.NewValue) { // select the comment control.IsCommentSelected = true; } else { // deselect the comment control.IsCommentSelected = false; } } } #endif }
/// <summary> /// Mouse is double clicked in viewer. /// </summary> private void AnnotationTool_MouseDoubleClick(object sender, Vintasoft.Imaging.UI.VisualTools.VisualToolMouseEventArgs e) { if (CommentTool != null && e.Button == AnnotationTool.ActionButton) { // find annnotation view AnnotationView view = AnnotationTool.FindAnnotationView(e.X, e.Y); // if annotation contains the annotation if (view != null && view.Data.Comment != null) { // get annotation comment Comment comment = view.Data.Comment; // find comment control ICommentControl commentControl = CommentTool.FindCommentControl(comment); // if comment control is found if (commentControl != null) { if (CommentTool.SelectedComment != commentControl) { CommentTool.SelectedComment = commentControl; } // open comment comment.IsOpen = true; } } } }
/// <summary> /// Searches the comment control for specified comment. /// </summary> /// <param name="comment">The comment.</param> public ICommentControl FindCommentControl(Comment comment) { foreach (ICommentControl control in commentsLayoutPanel.Controls) { ICommentControl result = control.FindCommentControl(comment); if (result != null) { return(result); } } return(null); }
/// <summary> /// Searches the comment control for specified comment source. /// </summary> /// <param name="source">The comment source.</param> public ICommentControl FindControlCommentBySource(object source) { foreach (ICommentControl control in commentsLayoutPanel.Controls) { Comment comment = control.Comment.FindCommentBySource(source); if (comment != null) { ICommentControl result = control.FindCommentControl(comment); if (result != null) { return(result); } } } return(null); }