XmlStreamStore.GetAnnotations Método

Definición

Devuelve una lista de todas las anotaciones del almacén.

Sobrecargas

Nombre Description
GetAnnotations()

Devuelve una lista de todas las anotaciones del almacén.

GetAnnotations(ContentLocator)

Devuelve una lista de anotaciones que tienen Anchors con localizadores que comienzan con una secuencia coincidente ContentLocatorPart .

Ejemplos

En el ejemplo siguiente se muestra cómo usar el GetAnnotations método para determinar si hay anotaciones contenidas en el almacén.

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

Devuelve una lista de todas las anotaciones del almacén.

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)

Devoluciones

Lista de todas las anotaciones que están actualmente en el almacén.

Excepciones

Dispose se ha llamado a en la tienda.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el GetAnnotations método para determinar si hay anotaciones en el almacén.

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

Comentarios

El GetAnnotations método nunca devolverá null; sin embargo, la lista puede estar vacía si el almacén no contiene ninguna anotación.

Consulte también

Se aplica a

GetAnnotations(ContentLocator)

Devuelve una lista de anotaciones que tienen Anchors con localizadores que comienzan con una secuencia coincidente 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

Secuencia inicial ContentLocatorPart para la que se devuelven anotaciones coincidentes.

Devoluciones

Lista de anotaciones que tienen Anchors con localizadores que inician y coinciden con el especificado anchorLocator; de lo contrario, null si no se encontraron anotaciones coincidentes.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el GetAnnotations método para determinar si hay anotaciones en el almacén.

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

Comentarios

Este GetAnnotations método usa internamente el StartsWith método de la ContentLocator clase para buscar y buscar las anotaciones que se van a devolver.

Consulte también

Se aplica a