AnnotationStore.GetAnnotations Método

Definição

Retorna uma lista de anotações contidas no repositório.

Sobrecargas

GetAnnotations()

Retorna uma lista de todas as anotações no repositório.

GetAnnotations(ContentLocator)

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

Exemplos

O exemplo a seguir mostra como usar o GetAnnotations método para determinar se há anotações contidas no repositório.

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

Retorna uma lista de todas as anotações no repositório.

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)

Retornos

IList<Annotation>

A lista de todas as anotações atualmente contidas no repositório.

Exceções

Dispose foi chamado no repositório.

Exemplos

O exemplo a seguir mostra como usar o GetAnnotations método para determinar se há anotações contidas no repositório.

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

Confira também

Aplica-se a

GetAnnotations(ContentLocator)

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

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 ContentLocatorPart inicial para a qual retornar anotações correspondentes.

Retornos

IList<Annotation>

A lista de anotações que têm Anchors com localizadores que iniciam e correspondem ao anchorLocator determinado; caso contrário, null se nenhuma anotação correspondente for encontrada.

Comentários

Esse GetAnnotations método usa internamente o StartsWith método da ContentLocator classe para pesquisar e corresponder às anotações a serem retornadas.

Confira também

Aplica-se a