AnnotationStore.GetAnnotations Método

Definição

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

Sobrecargas

Nome Description
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 correspondente ContentLocatorPart .

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

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

Exceções

Dispose foi chamado na loja.

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

Retornos

A lista de anotações que têm Anchors com localizadores que iniciam e correspondem ao determinado anchorLocator; caso contrário, null se nenhuma anotação correspondente tiver sido 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