AnnotationStore.GetAnnotations Método

Definição

Devolve uma lista de anotações contidas na loja.

Sobrecargas

Name Description
GetAnnotations()

Devolve uma lista de todas as anotações da loja.

GetAnnotations(ContentLocator)

Devolve uma lista de anotações que têm Anchors com localizadores que começam com uma sequência correspondente ContentLocatorPart .

Exemplos

O exemplo seguinte mostra como usar o GetAnnotations método para determinar se existem anotações contidas na loja.

// ---------------------------- 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()

Devolve uma lista de todas as anotações da loja.

public:
 abstract System::Collections::Generic::IList<System::Windows::Annotations::Annotation ^> ^ GetAnnotations();
public abstract System.Collections.Generic.IList<System.Windows.Annotations.Annotation> GetAnnotations();
abstract member GetAnnotations : unit -> System.Collections.Generic.IList<System.Windows.Annotations.Annotation>
Public MustOverride Function GetAnnotations () As IList(Of Annotation)

Devoluções

A lista de todas as anotações atualmente contidas na loja.

Exceções

Dispose foi chamado à loja.

Exemplos

O exemplo seguinte mostra como usar o GetAnnotations método para determinar se existem anotações contidas na loja.

// ---------------------------- 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();
    }
}

Ver também

Aplica-se a

GetAnnotations(ContentLocator)

Devolve uma lista de anotações que têm Anchors com localizadores que começam com uma sequência correspondente ContentLocatorPart .

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

Parâmetros

anchorLocator
ContentLocator

A sequência inicial ContentLocatorPart para devolver anotações correspondentes para.

Devoluções

A lista de anotações que têm Anchors com localizadores que iniciam e correspondem ao dado anchorLocator; caso contrário, null se não foram encontradas anotações correspondentes.

Observações

Este GetAnnotations método utiliza internamente o StartsWith método da ContentLocator classe para procurar e comparar as anotações que retornam.

Ver também

Aplica-se a