Compartilhar via


SettingsExtensibility.SubscribeAsync Method

Definition

Overloads

SubscribeAsync(IReadOnlyCollection<Setting>, CancellationToken, Action<SettingValues>)

Subscribes to receive updates when the values of settings is changed.

SubscribeAsync(IReadOnlyCollection<SettingCategory>, CancellationToken, Action<SettingValues>)

Subscribes to receive updates when the values of settings is changed.

SubscribeAsync(IReadOnlyCollection<SettingIdentifier>, CancellationToken, Action<SettingValues>)

Subscribes to receive updates when the values of settings is changed.

SubscribeAsync<T>(Setting+ObjectArray, CancellationToken, Action<SettingValue<T[]>>)

Subscribes to receive updates when the values of a setting is changed.

SubscribeAsync<T>(Setting<T>, CancellationToken, Action<SettingValue<T>>)

Subscribes to receive updates when the values of a setting is changed.

SubscribeAsync<T>(SettingIdentifier<T>, CancellationToken, Action<SettingValue<T>>)

Subscribes to receive updates when the values of a setting is changed.

SubscribeAsync(IReadOnlyCollection<Setting>, CancellationToken, Action<SettingValues>)

Subscribes to receive updates when the values of settings is changed.

public System.Threading.Tasks.Task<IDisposable> SubscribeAsync (System.Collections.Generic.IReadOnlyCollection<Microsoft.VisualStudio.Extensibility.Settings.Setting> settings, System.Threading.CancellationToken cancellationToken, Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValues> changeHandler);
member this.SubscribeAsync : System.Collections.Generic.IReadOnlyCollection<Microsoft.VisualStudio.Extensibility.Settings.Setting> * System.Threading.CancellationToken * Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValues> -> System.Threading.Tasks.Task<IDisposable>
Public Function SubscribeAsync (settings As IReadOnlyCollection(Of Setting), cancellationToken As CancellationToken, changeHandler As Action(Of SettingValues)) As Task(Of IDisposable)

Parameters

settings
IReadOnlyCollection<Setting>

The settings to be observed.

cancellationToken
CancellationToken

Cancellation cancellationToken for the async operation.

changeHandler
Action<SettingValues>

A callback invoked to provide updated values of the requested settings.

Returns

An object that can be disposed when the subscription is no longer required.

Remarks

changeHandler is always invoked at least once with the current value of the requested settings.

Applies to

SubscribeAsync(IReadOnlyCollection<SettingCategory>, CancellationToken, Action<SettingValues>)

Subscribes to receive updates when the values of settings is changed.

public System.Threading.Tasks.Task<IDisposable> SubscribeAsync (System.Collections.Generic.IReadOnlyCollection<Microsoft.VisualStudio.Extensibility.Settings.SettingCategory> settingCategories, System.Threading.CancellationToken cancellationToken, Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValues> changeHandler);
member this.SubscribeAsync : System.Collections.Generic.IReadOnlyCollection<Microsoft.VisualStudio.Extensibility.Settings.SettingCategory> * System.Threading.CancellationToken * Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValues> -> System.Threading.Tasks.Task<IDisposable>
Public Function SubscribeAsync (settingCategories As IReadOnlyCollection(Of SettingCategory), cancellationToken As CancellationToken, changeHandler As Action(Of SettingValues)) As Task(Of IDisposable)

Parameters

settingCategories
IReadOnlyCollection<SettingCategory>

The setting categories to be observed.

cancellationToken
CancellationToken

Cancellation cancellationToken for the async operation.

changeHandler
Action<SettingValues>

A callback invoked to provide updated values of the requested settings.

Returns

An object that can be disposed when the subscription is no longer required.

Remarks

changeHandler is always invoked at least once with the current value of the requested settings.

Applies to

SubscribeAsync(IReadOnlyCollection<SettingIdentifier>, CancellationToken, Action<SettingValues>)

Subscribes to receive updates when the values of settings is changed.

public System.Threading.Tasks.Task<IDisposable> SubscribeAsync (System.Collections.Generic.IReadOnlyCollection<Microsoft.VisualStudio.Extensibility.Settings.SettingIdentifier> settingIdPatterns, System.Threading.CancellationToken cancellationToken, Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValues> changeHandler);
member this.SubscribeAsync : System.Collections.Generic.IReadOnlyCollection<Microsoft.VisualStudio.Extensibility.Settings.SettingIdentifier> * System.Threading.CancellationToken * Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValues> -> System.Threading.Tasks.Task<IDisposable>
Public Function SubscribeAsync (settingIdPatterns As IReadOnlyCollection(Of SettingIdentifier), cancellationToken As CancellationToken, changeHandler As Action(Of SettingValues)) As Task(Of IDisposable)

Parameters

settingIdPatterns
IReadOnlyCollection<SettingIdentifier>

The full identifiers of the settings, including the categories they are nested under. settingIdPatterns can be terminated with a single '*' character to match multiple settings the identifiers of which share a common prefix.

cancellationToken
CancellationToken

Cancellation cancellationToken for the async operation.

changeHandler
Action<SettingValues>

A callback invoked to provide updated values of the requested settings.

Returns

An object that can be disposed when the subscription is no longer required.

Remarks

changeHandler is always invoked at least once with the current value of the requested settings.

Applies to

SubscribeAsync<T>(Setting+ObjectArray, CancellationToken, Action<SettingValue<T[]>>)

Subscribes to receive updates when the values of a setting is changed.

public System.Threading.Tasks.Task<IDisposable> SubscribeAsync<T> (Microsoft.VisualStudio.Extensibility.Settings.Setting.ObjectArray setting, System.Threading.CancellationToken cancellationToken, Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValue<T[]>> changeHandler) where T : Microsoft.VisualStudio.Extensibility.Settings.IArraySettingItemConvertible, new();
member this.SubscribeAsync : Microsoft.VisualStudio.Extensibility.Settings.Setting.ObjectArray * System.Threading.CancellationToken * Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValue<'T[]>> -> System.Threading.Tasks.Task<IDisposable> (requires 'T :> Microsoft.VisualStudio.Extensibility.Settings.IArraySettingItemConvertible and 'T : (new : unit -> 'T))
Public Function SubscribeAsync(Of T As {IArraySettingItemConvertibleNew}) (setting As Setting.ObjectArray, cancellationToken As CancellationToken, changeHandler As Action(Of SettingValue(Of T()))) As Task(Of IDisposable)

Type Parameters

T

The type of the setting value.

Parameters

setting
Setting.ObjectArray

The setting to be observed.

cancellationToken
CancellationToken

Cancellation cancellationToken for the async operation.

changeHandler
Action<SettingValue<T[]>>

A callback invoked to provide updated values of the requested setting.

Returns

An object that can be disposed when the subscription is no longer required.

Remarks

changeHandler is always invoked at least once with the current value of the requested settings.

Applies to

SubscribeAsync<T>(Setting<T>, CancellationToken, Action<SettingValue<T>>)

Subscribes to receive updates when the values of a setting is changed.

public System.Threading.Tasks.Task<IDisposable> SubscribeAsync<T> (Microsoft.VisualStudio.Extensibility.Settings.Setting<T> setting, System.Threading.CancellationToken cancellationToken, Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValue<T>> changeHandler);
member this.SubscribeAsync : Microsoft.VisualStudio.Extensibility.Settings.Setting<'T> * System.Threading.CancellationToken * Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValue<'T>> -> System.Threading.Tasks.Task<IDisposable>
Public Function SubscribeAsync(Of T) (setting As Setting(Of T), cancellationToken As CancellationToken, changeHandler As Action(Of SettingValue(Of T))) As Task(Of IDisposable)

Type Parameters

T

The type of the setting value.

Parameters

setting
Setting<T>

The setting to be observed.

cancellationToken
CancellationToken

Cancellation cancellationToken for the async operation.

changeHandler
Action<SettingValue<T>>

A callback invoked to provide updated values of the requested setting.

Returns

An object that can be disposed when the subscription is no longer required.

Remarks

changeHandler is always invoked at least once with the current value of the requested settings.

Applies to

SubscribeAsync<T>(SettingIdentifier<T>, CancellationToken, Action<SettingValue<T>>)

Subscribes to receive updates when the values of a setting is changed.

public System.Threading.Tasks.Task<IDisposable> SubscribeAsync<T> (Microsoft.VisualStudio.Extensibility.Settings.SettingIdentifier<T> settingId, System.Threading.CancellationToken cancellationToken, Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValue<T>> changeHandler);
member this.SubscribeAsync : Microsoft.VisualStudio.Extensibility.Settings.SettingIdentifier<'T> * System.Threading.CancellationToken * Action<Microsoft.VisualStudio.Extensibility.Settings.SettingValue<'T>> -> System.Threading.Tasks.Task<IDisposable>
Public Function SubscribeAsync(Of T) (settingId As SettingIdentifier(Of T), cancellationToken As CancellationToken, changeHandler As Action(Of SettingValue(Of T))) As Task(Of IDisposable)

Type Parameters

T

The type of the setting value.

Parameters

settingId
SettingIdentifier<T>

The full identifier of the setting, including the categories it is nested under.

cancellationToken
CancellationToken

Cancellation cancellationToken for the async operation.

changeHandler
Action<SettingValue<T>>

A callback invoked to provide updated values of the requested setting.

Returns

An object that can be disposed when the subscription is no longer required.

Remarks

changeHandler is always invoked at least once with the current value of the requested settings.

Applies to