///////////////////////////////////////////////////////////////////////////////////////////////////// // NON-PUBLIC PROCEDURES ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Occurs before the editor's document text has changed. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">A <see cref="EditorSnapshotChangingEventArgs"/> that contains the event data.</param> private void OnEditorDocumentTextChanging(object sender, EditorSnapshotChangingEventArgs e) { e.Cancel = (cancelCheckBox.IsChecked == true); if (e.Cancel) { if (alternateTextCheckBox.IsChecked == true) { // Temporarily turn off cancel and insert date/time instead cancelCheckBox.IsChecked = false; editor.ActiveView.ReplaceSelectedText(TextChangeTypes.Custom, DateTime.Now.ToString()); cancelCheckBox.IsChecked = true; MessageBox.Show("Text change cancelled, current date/time inserted instead.", "Notification", MessageBoxButton.OK, MessageBoxImage.Information); } else { // Simple cancel MessageBox.Show("Text change cancelled.", "Notification", MessageBoxButton.OK, MessageBoxImage.Information); } } }
/// <summary> /// Occurs before a text change occurs to an <see cref="IEditorDocument"/> that uses this language. /// </summary> /// <param name="editor">The <see cref="SyntaxEditor"/> whose <see cref="IEditorDocument"/> that is changing.</param> /// <param name="e">The <c>EditorSnapshotChangingEventArgs</c> that contains the event data.</param> protected override void OnDocumentTextChanging(SyntaxEditor editor, EditorSnapshotChangingEventArgs e) { // Call the base method base.OnDocumentTextChanging(editor, e); }
public void NotifyDocumentTextChanging(SyntaxEditor editor, EditorSnapshotChangingEventArgs e) { }
/// <summary> /// Occurs before a text change occurs to an <see cref="IEditorDocument"/> that uses this language. /// </summary> /// <param name="editor">The <see cref="SyntaxEditor"/> whose <see cref="IEditorDocument"/> that is changing.</param> /// <param name="e">The <c>EditorSnapshotChangingEventArgs</c> that contains the event data.</param> protected virtual void OnDocumentTextChanging(SyntaxEditor editor, EditorSnapshotChangingEventArgs e) { }
/// <summary> /// Notifies before a text change occurs to an <see cref="IEditorDocument"/>. /// </summary> /// <param name="editor">The <see cref="SyntaxEditor"/> whose <see cref="IEditorDocument"/> that is changing.</param> /// <param name="e">The <c>EditorSnapshotChangingEventArgs</c> that contains the event data.</param> void IEditorDocumentTextChangeEventSink.NotifyDocumentTextChanging(SyntaxEditor editor, EditorSnapshotChangingEventArgs e) { this.OnDocumentTextChanging(editor, e); }