// Function to create a text note private void CreateTextNote(object sender, RoutedEventArgs e) { try { AnnotationHelper.CreateTextStickyNoteForSelection(currentAnnotService, "Vista user"); } catch (InvalidOperationException) { // If someone tries to highlight without actually selecting text, do nothing. } }
private void DocumentViewer_AddComment(object sender, RoutedEventArgs e) { //Get the current user's name as the author string userName = System.Environment.UserName; //The AnnotationHelper.CreateTextStickyNoteForSelection method //will throw an exception if no text is selected. try { AnnotationHelper.CreateTextStickyNoteForSelection(fixedAnnotationService, userName); } catch (InvalidOperationException) { MessageBox.Show("Please select some text to annotate."); } }
// -------------------------- OnAddComment ---------------------------- void OnAddComment(object sender, RoutedEventArgs args) { try { string userName = System.Windows.Forms.SystemInformation.UserName; AnnotationHelper.CreateTextStickyNoteForSelection( _annServ, userName); } catch (InvalidOperationException) { return; } //AddBookmarkOrComment(CommentsList); //Annotation ann1 = _annStore.GetAnnotations()[0]; //ColorConverter converter = new ColorConverter(); //Nullable<Color> color = ((SolidColorBrush)Brushes.Yellow).Color; //ann1.Cargos[0].Contents[0].Attributes[0].Value = // converter.ConvertToInvariantString(color.Value); }