AnnotationService AnnotationService AnnotationService AnnotationService Class

Definition

Provides core services of the Microsoft Annotations Framework to manage and display user annotations.

public ref class AnnotationService sealed : System::Windows::Threading::DispatcherObject
public sealed class AnnotationService : System.Windows.Threading.DispatcherObject
type AnnotationService = class
    inherit DispatcherObject
Public NotInheritable Class AnnotationService
Inherits DispatcherObject
Inheritance
AnnotationServiceAnnotationServiceAnnotationServiceAnnotationService

Examples

The following example shows how to create and start an AnnotationService.

// ------------------------ StartAnnotations --------------------------
/// <summary>
///   Enables annotations and displays all that are viewable.</summary>
private void StartAnnotations()
{
    // If there is no AnnotationService yet, create one.
    if (_annotService == null)
        // docViewer is a document viewing control named in Window1.xaml.
        _annotService = new AnnotationService(docViewer);

    // If the AnnotationService is currently enabled, disable it.
    if (_annotService.IsEnabled == true)
        _annotService.Disable();

    // Open a stream to the file for storing annotations.
    _annotStream = new FileStream(
        _annotStorePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);

    // Create an AnnotationStore using the file stream.
    _annotStore = new XmlStreamStore(_annotStream);

    // Enable the AnnotationService using the new store.
    _annotService.Enable(_annotStore);
}// end:StartAnnotations()
' ------------------------ StartAnnotations --------------------------
''' <summary>
'''   Enables annotations and displays all that are viewable.</summary>
Private Sub StartAnnotations()
	' If there is no AnnotationService yet, create one.
	If _annotService Is Nothing Then
		' docViewer is a document viewing control named in Window1.xaml.
		_annotService = New AnnotationService(docViewer)
	End If

	' If the AnnotationService is currently enabled, disable it.
	If _annotService.IsEnabled = True Then
		_annotService.Disable()
	End If

	' Open a stream to the file for storing annotations.
	_annotStream = New FileStream(_annotStorePath, FileMode.OpenOrCreate, FileAccess.ReadWrite)

	' Create an AnnotationStore using the file stream.
	_annotStore = New XmlStreamStore(_annotStream)

	' Enable the AnnotationService using the new store.
	_annotService.Enable(_annotStore)
End Sub ' end:StartAnnotations()

Constructors

AnnotationService(DocumentViewerBase) AnnotationService(DocumentViewerBase) AnnotationService(DocumentViewerBase) AnnotationService(DocumentViewerBase)

Initializes a new instance of the AnnotationService class for use with a specified DocumentViewer or FlowDocumentPageViewer control.

AnnotationService(FlowDocumentReader) AnnotationService(FlowDocumentReader) AnnotationService(FlowDocumentReader) AnnotationService(FlowDocumentReader)

Initializes a new instance of the AnnotationService class for use with a specified FlowDocumentReader control.

AnnotationService(FlowDocumentScrollViewer) AnnotationService(FlowDocumentScrollViewer) AnnotationService(FlowDocumentScrollViewer) AnnotationService(FlowDocumentScrollViewer)

Initializes a new instance of the AnnotationService class for use with a specified FlowDocumentScrollViewer control.

Fields

ClearHighlightsCommand ClearHighlightsCommand ClearHighlightsCommand ClearHighlightsCommand

Represents the command to clear highlight annotations from the current selection.

CreateHighlightCommand CreateHighlightCommand CreateHighlightCommand CreateHighlightCommand

Represents the command to create a highlight annotation on the current selection.

CreateInkStickyNoteCommand CreateInkStickyNoteCommand CreateInkStickyNoteCommand CreateInkStickyNoteCommand

Represents the command to create an ink-note annotation on the current selection.

CreateTextStickyNoteCommand CreateTextStickyNoteCommand CreateTextStickyNoteCommand CreateTextStickyNoteCommand

Represents the command to create a text-note annotation on the current selection.

DeleteAnnotationsCommand DeleteAnnotationsCommand DeleteAnnotationsCommand DeleteAnnotationsCommand

Represents the command to delete all ink-note, text-note, and highlight annotations in the current selection.

DeleteStickyNotesCommand DeleteStickyNotesCommand DeleteStickyNotesCommand DeleteStickyNotesCommand

Represents the command to delete all ink-note and text-note annotations in the current selection.

Properties

Dispatcher Dispatcher Dispatcher Dispatcher

Gets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)
IsEnabled IsEnabled IsEnabled IsEnabled

Gets a value that indicates whether the AnnotationService is enabled.

Store Store Store Store

Gets the AnnotationStore used by this AnnotationService.

Methods

CheckAccess() CheckAccess() CheckAccess() CheckAccess()

Determines whether the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
Disable() Disable() Disable() Disable()

Disables annotations processing and hides all visible annotations.

Enable(AnnotationStore) Enable(AnnotationStore) Enable(AnnotationStore) Enable(AnnotationStore)

Enables the AnnotationService for use with a given AnnotationStore and displays all visible annotations.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetService(DocumentViewerBase) GetService(DocumentViewerBase) GetService(DocumentViewerBase) GetService(DocumentViewerBase)

Returns the AnnotationService instance associated with a specified document viewing control.

GetService(FlowDocumentReader) GetService(FlowDocumentReader) GetService(FlowDocumentReader) GetService(FlowDocumentReader)

Returns the AnnotationService associated with a specified FlowDocumentReader.

GetService(FlowDocumentScrollViewer) GetService(FlowDocumentScrollViewer) GetService(FlowDocumentScrollViewer) GetService(FlowDocumentScrollViewer)

Returns the AnnotationService associated with a specified FlowDocumentScrollViewer.

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)
VerifyAccess() VerifyAccess() VerifyAccess() VerifyAccess()

Enforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)

Applies to