다음을 통해 공유


XmlStreamStore.Flush 메서드

정의

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

public:
 override void Flush();
public override void Flush ();
override this.Flush : unit -> unit
Public Overrides Sub Flush ()

예외

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

I/O Stream을 저장소에 대해 설정하지 않은 경우

저장소 I/O Stream이 읽기 전용이며 출력용으로 액세스할 수 없는 경우

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다 합니다 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();
}

적용 대상

추가 정보