XmlStreamStore.GetAnnotations Método

Definição

Retorna uma lista de todas as anotações 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:
 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)

Retornos

A lista de todas as anotações que estão 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 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();
    }
}

Comentários

O GetAnnotations método nunca retornará null; no entanto, a lista poderá estar vazia se o repositório não contiver anotações.

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:
 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)

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.

Exemplos

O exemplo a seguir mostra como usar o GetAnnotations método para determinar se há anotações 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();
    }
}

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