AnnotationStore.GetAnnotations メソッド

定義

ストア内に格納されている注釈の一覧を返します。

オーバーロード

GetAnnotations()

ストア内のすべての注釈の一覧を返します。

GetAnnotations(ContentLocator)

一致する ContentLocatorPart シーケンスで開始するロケーターを含む Anchors を持つ注釈の一覧を返します。

次の例は、 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)

一致する ContentLocatorPart シーケンスで開始するロケーターを含む Anchors を持つ注釈の一覧を返します。

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、 クラスの メソッドをStartsWithContentLocator内部的に使用して、返される注釈を検索して照合します。

こちらもご覧ください

適用対象