Partage via


XmlStreamStore.GetAnnotations Méthode

Définition

Retourne une liste de toutes les annotations du magasin.

Surcharges

GetAnnotations()

Retourne une liste de toutes les annotations du magasin.

GetAnnotations(ContentLocator)

Retourne une liste d'annotations qui ont des Anchors avec des localisateurs qui commencent par une séquence ContentLocatorPart correspondante.

Exemples

L’exemple suivant montre comment utiliser la GetAnnotations méthode pour déterminer s’il existe des annotations contenues dans le magasin.

// ---------------------------- CloseFile -----------------------------
private void CloseFile()
{
    // If there are existing annotations, then they should be saved.
    if (_annStore.GetAnnotations().Count > 0)
    {
        string backupFile = _fileName + ".annotations" + ".xml";
        FileStream backupStream = new FileStream(backupFile, FileMode.Create);
        CopyStream(_annotationBuffer, backupStream);
        _annStore.Flush();
        _annServ.Disable();
    }
}

GetAnnotations()

Retourne une liste de toutes les annotations du magasin.

public:
 override System::Collections::Generic::IList<System::Windows::Annotations::Annotation ^> ^ GetAnnotations();
public override System.Collections.Generic.IList<System.Windows.Annotations.Annotation> GetAnnotations ();
override this.GetAnnotations : unit -> System.Collections.Generic.IList<System.Windows.Annotations.Annotation>
Public Overrides Function GetAnnotations () As IList(Of Annotation)

Retours

IList<Annotation>

Liste de toutes les annotations qui sont actuellement dans le magasin.

Exceptions

Dispose a été appelé sur le magasin.

Exemples

L’exemple suivant montre comment utiliser la GetAnnotations méthode pour déterminer s’il existe des annotations dans le magasin.

// ---------------------------- CloseFile -----------------------------
private void CloseFile()
{
    // If there are existing annotations, then they should be saved.
    if (_annStore.GetAnnotations().Count > 0)
    {
        string backupFile = _fileName + ".annotations" + ".xml";
        FileStream backupStream = new FileStream(backupFile, FileMode.Create);
        CopyStream(_annotationBuffer, backupStream);
        _annStore.Flush();
        _annServ.Disable();
    }
}

Remarques

La GetAnnotations méthode ne retourne nulljamais ; toutefois, la liste peut être vide si le magasin ne contient aucune annotation.

Voir aussi

S’applique à

GetAnnotations(ContentLocator)

Retourne une liste d'annotations qui ont des Anchors avec des localisateurs qui commencent par une séquence ContentLocatorPart correspondante.

public:
 override System::Collections::Generic::IList<System::Windows::Annotations::Annotation ^> ^ GetAnnotations(System::Windows::Annotations::ContentLocator ^ anchorLocator);
public override System.Collections.Generic.IList<System.Windows.Annotations.Annotation> GetAnnotations (System.Windows.Annotations.ContentLocator anchorLocator);
override this.GetAnnotations : System.Windows.Annotations.ContentLocator -> System.Collections.Generic.IList<System.Windows.Annotations.Annotation>
Public Overrides Function GetAnnotations (anchorLocator As ContentLocator) As IList(Of Annotation)

Paramètres

anchorLocator
ContentLocator

Séquence ContentLocatorPart initiale pour laquelle retourner des annotations correspondantes.

Retours

IList<Annotation>

Liste des annotations qui ont des Anchors avec des localisateurs qui commencent et correspondent à l'anchorLocator donné ; sinon, null si aucune annotation correspondante n'est trouvée.

Exemples

L’exemple suivant montre comment utiliser la GetAnnotations méthode pour déterminer s’il existe des annotations dans le magasin.

// ---------------------------- CloseFile -----------------------------
private void CloseFile()
{
    // If there are existing annotations, then they should be saved.
    if (_annStore.GetAnnotations().Count > 0)
    {
        string backupFile = _fileName + ".annotations" + ".xml";
        FileStream backupStream = new FileStream(backupFile, FileMode.Create);
        CopyStream(_annotationBuffer, backupStream);
        _annStore.Flush();
        _annServ.Disable();
    }
}

Remarques

Cette GetAnnotations méthode utilise en interne la StartsWith méthode de la ContentLocator classe pour rechercher et faire correspondre les annotations à retourner.

Voir aussi

S’applique à