Share via


ConnectedServiceGrid.ConfigureServiceInstanceAsync Method

Definition

Configure a service instance either through a dialog or linking to the configure web page.

public:
 virtual System::Threading::Tasks::Task<bool> ^ ConfigureServiceInstanceAsync(Microsoft::VisualStudio::ConnectedServices::ConnectedServiceInstance ^ instance, System::Threading::CancellationToken ct);
public virtual System.Threading.Tasks.Task<bool> ConfigureServiceInstanceAsync (Microsoft.VisualStudio.ConnectedServices.ConnectedServiceInstance instance, System.Threading.CancellationToken ct);
abstract member ConfigureServiceInstanceAsync : Microsoft.VisualStudio.ConnectedServices.ConnectedServiceInstance * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
override this.ConfigureServiceInstanceAsync : Microsoft.VisualStudio.ConnectedServices.ConnectedServiceInstance * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Overridable Function ConfigureServiceInstanceAsync (instance As ConnectedServiceInstance, ct As CancellationToken) As Task(Of Boolean)

Parameters

instance
ConnectedServiceInstance

The service instance to configure.

ct
CancellationToken

CancellationToken used to cancel the configuration operation.

Returns

Returns a Task for the configuration. The Task's result value indicates whether any changes were made to the instance.

Remarks

This method is guaranteed to be called from the UI thread, and only on providers that return 'true' from IsAuthenticated if a ConnectedServiceAuthenticator is implemented.

If an implementation desires to present blocking/modal UI, it may do so. If the service instance is configured synchronously before the method returns, the returned Task should be marked as completed (for example, via Task.FromResult()).

If the implementation runs in the background, it may return an in-progress Task, and the Connected Services code will refresh the UI once the Task completes. In this case, the Connected Services code may cancel the task via the CancellationToken if the user closes the Conencted Services UI before the instance has been created.

If the implementation does not or cannot monitor the configuration of the instance, it may return null. In this case, the Connected Services code will do nothing, and requires the user to manually refresh/enumerate the service instances to check for changes to the configured instance.

If the implementation shows/handles any errors, the Task should not fault on them, nor throw them as Exceptions. If the returned Task completes in a Faulted state (such that the Exception member is non-null) the Connected Services UI will inform the user of the failure.

Applies to