AnnotationStore.Flush Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Erzwingt, dass alle Anmerkungsdaten, die in internen Puffern aufbewahrt werden, auf das zugrunde liegende Speichergerät geschrieben werden.
public:
abstract void Flush();
public abstract void Flush();
abstract member Flush : unit -> unit
Public MustOverride Sub Flush ()
Ausnahmen
Dispose wurde im Store aufgerufen.
Beispiele
Das folgende Beispiel zeigt, wie Die Flush Methode verwendet wird, wenn die Anwendung die 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
Das folgende Beispiel zeigt die Verwendung der Methoden und DeleteAnnotation deren Flush Verwendung.
// ------------------------- 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();
}
Hinweise
Anwendungen, die ein explizites Speichermodell verwenden, können bei Bedarf direkt festgelegt AutoFlushfalse und aufgerufen werden Flush .
Anwendungen, die ein implizites Speichermodell verwenden, können festlegen, dass dies AutoFlushtrueFlush nach jedem Speichervorgang automatisch aufgerufen wird (Hinzufügen, Löschen oder Ändern).