XmlStreamStore.GetAnnotations Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Devolve uma lista de todas as anotações da 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:
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)
Devoluções
A lista de todas as anotações que estão atualmente 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 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();
}
}
Observações
O GetAnnotations método nunca retornará null; no entanto, a lista pode ficar vazia se a loja não contiver anotações.
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:
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 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.
Exemplos
O exemplo seguinte mostra como usar o GetAnnotations método para determinar se existem anotações 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();
}
}
Observações
Este GetAnnotations método utiliza internamente o StartsWith método da ContentLocator classe para procurar e comparar as anotações que retornam.