Compartilhar via


Package.CreateSettingsObserverAsync Method

Definition

Creates a settings observer object for the package. This method is called when unified settings are active, but only if the package has one or more ProvideSettingsObserverAttributes.

protected virtual System.Threading.Tasks.Task<object?> CreateSettingsObserverAsync (Type observerType, Microsoft.VisualStudio.Shell.SettingsObserverArguments args, System.Threading.CancellationToken token);
abstract member CreateSettingsObserverAsync : Type * Microsoft.VisualStudio.Shell.SettingsObserverArguments * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
override this.CreateSettingsObserverAsync : Type * Microsoft.VisualStudio.Shell.SettingsObserverArguments * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
Protected Overridable Function CreateSettingsObserverAsync (observerType As Type, args As SettingsObserverArguments, token As CancellationToken) As Task(Of Object)

Parameters

observerType
Type

The type of the settings observer to be created.

args
SettingsObserverArguments

The arguments for creating the settings observer.

token
CancellationToken

A cancellation token.

Returns

Remarks

If your observer needs to be created with more context than the data contained in args, override this virtual method.

If your observer does not implement ISettingsObserver (either natively or by deriving from SettingsObserver, it must subscribe to unified settings changes either in its constructor or in your override of this virtual method.

Applies to