AnnotationStore.Flush 메서드

정의

내부 버퍼에 유지된 모든 주석 데이터를 내부 스토리지 디바이스에 쓰도록 합니다.

public:
 abstract void Flush();
public abstract void Flush ();
abstract member Flush : unit -> unit
Public MustOverride Sub Flush ()

예외

Dispose가 저장소에서 호출되었습니다.

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다 합니다 Flush 애플리케이션을 닫으면 메서드는 AnnotationService합니다.

// -------------------------- StopAnnotations -------------------------
/// <summary>
///   Disables annotations processing and hides annotations.</summary>
public void StopAnnotations()
{
    // If the AnnotationStore is active, flush and close it.
    if ( (_annotService != null) && _annotService.IsEnabled )
    {
        _annotService.Store.Flush();
        _annotStream.Flush();
        _annotStream.Close();
    }

    // If the AnnotationService is active, shut it down.
    if (_annotService != null)
    {
        if (_annotService.IsEnabled)
            _annotService.Disable();
        _annotService = null;
    }
}// end:StopAnnotations()
' -------------------------- StopAnnotations -------------------------
''' <summary>
'''   Disables annotations processing and hides annotations.</summary>
Public Sub StopAnnotations()
    ' If the AnnotationStore is active, flush and close it.
    If (_annotService IsNot Nothing) AndAlso _annotService.IsEnabled Then
        _annotService.Store.Flush()
        _annotStream.Flush()
        _annotStream.Close()
    End If

    ' If the AnnotationService is active, shut it down.
    If _annotService IsNot Nothing Then
        If _annotService.IsEnabled Then
            _annotService.Disable()
        End If
        _annotService = Nothing
    End If
End Sub

다음 예제에서는 사용 된 DeleteAnnotationFlush 메서드.

// ------------------------- DeleteMark_Click -------------------------
void DeleteMark_Click(object sender, RoutedEventArgs e)
{
    Annotation ann = ((MenuItem)sender).Tag as Annotation;
    _annStore.DeleteAnnotation(ann.Id);
    _annStore.Flush();

    MenuItem thisMenu = sender as MenuItem;
    ContextMenu parentMenu = thisMenu.Parent as ContextMenu;
    FrameworkElement dObj =
        parentMenu.PlacementTarget as FrameworkElement;
    while (!(dObj is StackPanel))
    {
        dObj = dObj.Parent as FrameworkElement;
    }

    ListBox collection = dObj.Parent as ListBox;
    collection.Items.Remove(dObj);
    Util.FlushDispatcher();
}

설명

명시적 저장 모델을 사용 하는 애플리케이션을 설정할 수 AutoFlushfalse 호출 Flush 직접을 적절 한 경우.

암시적 저장 모델을 사용 하는 애플리케이션을 설정할 수는 AutoFlushtrue 시킬 Flush 모든 저장소 작업 후 자동으로 호출 됩니다 (추가, 삭제 또는 수정).

적용 대상

추가 정보