AnnotationStore.GetAnnotations Метод

Определение

Возвращает список заметок, содержащихся в хранилище.

Перегрузки

GetAnnotations()

Возвращает список всех заметок в хранилище.

GetAnnotations(ContentLocator)

Возвращает список заметок, имеющих Anchors с указателями, начинающимися с соответствующей последовательности ContentLocatorPart.

Примеры

В следующем примере показано, как использовать GetAnnotations метод , чтобы определить, содержатся ли в хранилище заметки.

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

Возвращает список всех заметок в хранилище.

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)

Возвращаемое значение

Список всех заметок, находящихся в данный момент в хранилище.

Исключения

В хранилище уже выполнен вызов Dispose.

Примеры

В следующем примере показано, как использовать GetAnnotations метод , чтобы определить, содержатся ли в хранилище заметки.

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

Возвращает список заметок, имеющих Anchors с указателями, начинающимися с соответствующей последовательности 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)

Параметры

anchorLocator
ContentLocator

Начальная последовательность ContentLocatorPart для возврата соответствующих ей заметок.

Возвращаемое значение

Список заметок, имеющих Anchors с указателями, соответствующими заданному anchorLocator; или значение null, если соответствующие заметки не найдены.

Комментарии

Этот GetAnnotations метод использует StartsWith метод ContentLocator класса для поиска и сопоставления возвращаемых заметок.

См. также раздел

Применяется к