AnnotationService.Enable(AnnotationStore) Methode

Definitie

Hiermee schakelt u het AnnotationService voor gebruik met een bepaalde AnnotationStore functie in en worden alle zichtbare aantekeningen weergegeven.

public:
 void Enable(System::Windows::Annotations::Storage::AnnotationStore ^ annotationStore);
public void Enable(System.Windows.Annotations.Storage.AnnotationStore annotationStore);
member this.Enable : System.Windows.Annotations.Storage.AnnotationStore -> unit
Public Sub Enable (annotationStore As AnnotationStore)

Parameters

annotationStore
AnnotationStore

Het aantekeningsarchief dat moet worden gebruikt voor het lezen, schrijven en weergeven van aantekeningen.

Uitzonderingen

annotationStore is null.

Voorbeelden

In het volgende voorbeeld ziet u hoe u de Enable methode gebruikt wanneer u een 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)
        _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

Opmerkingen

Wanneer Enable alle aantekeningen in het venster van het viewer-besturingselement worden aangeroepen, worden weergegeven. (Het viewer-besturingselement dat is gekoppeld aan de annotatieservice wordt opgegeven in de parameter voor de AnnotationService constructor.)

Van toepassing op

Zie ook