AnnotationService.IsEnabled Propriedade

Definição

Obtém um valor que indica se o AnnotationService está habilitado.

C#
public bool IsEnabled { get; }

Valor da propriedade

true se AnnotationService estiver habilitado; caso contrário, false.

Exemplos

O exemplo a seguir mostra como usar a IsEnabled propriedade quando você cria e inicia um AnnotationService. Além disso, se o usuário optar por abrir um novo documento no controle visualizador, o AnnotationService deverá ser desabilitado para o documento antigo e, em seguida, habilitado para o novo documento.

C#
// ------------------------ StartAnnotations --------------------------
/// <summary>
///   Enables annotations and displays all that are viewable.</summary>
private void StartAnnotations()
{
    // If there is no AnnotationService yet, create one.
    if (_annotService == null)
        // docViewer is a document viewing control named in Window1.xaml.
        _annotService = new AnnotationService(docViewer);

    // If the AnnotationService is currently enabled, disable it.
    if (_annotService.IsEnabled == true)
        _annotService.Disable();

    // Open a stream to the file for storing annotations.
    _annotStream = new FileStream(
        _annotStorePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);

    // Create an AnnotationStore using the file stream.
    _annotStore = new XmlStreamStore(_annotStream);

    // Enable the AnnotationService using the new store.
    _annotService.Enable(_annotStore);
}// end:StartAnnotations()

Aplica-se a

Produto Versões
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

Confira também