Compartilhar via


AppUriHandlerRegistration.SetAppAddedHostsAsync Método

Definição

Registra hosts além dos hosts já definidos no AppxManifest.

public:
 virtual IAsyncAction ^ SetAppAddedHostsAsync(IIterable<AppUriHandlerHost ^> ^ hosts) = SetAppAddedHostsAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction SetAppAddedHostsAsync(IIterable<AppUriHandlerHost> const& hosts);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction SetAppAddedHostsAsync(IEnumerable<AppUriHandlerHost> hosts);
function setAppAddedHostsAsync(hosts)
Public Function SetAppAddedHostsAsync (hosts As IEnumerable(Of AppUriHandlerHost)) As IAsyncAction

Parâmetros

hosts

IIterable<AppUriHandlerHost>

IEnumerable<AppUriHandlerHost>

O conjunto de objetos AppUriHandlerHost a serem registrados.

Retornos

Representa a ação assíncrona.

Atributos

Exemplos

// Application logic can determine which are the new domains to register 
// Here we just have a hardcoded list. 
List<AppUriHandlerHost> hosts = await registration.GetAppAddedHostsAsync(); 

// Application logic can determine which are the new domains to register 
hosts.AddRange(new[] { 
    new AppUriHandlerHost("www.contoso.com"), 
    new AppUriHandlerHost("*.example.contoso.com") 
    }); 

// Application logic can determine which domains to remove from the list 
hosts.RemoveAll(_ => _.Name == "removed.contoso.com"); 

await registration.SetAppAddedHostsAsync(hosts); 

Comentários

Essa API não substitui, substitui ou remove entradas registradas por meio do AppxManifest.

Aplica-se a