共用方式為


AppUriHandlerRegistration.GetAppAddedHostsAsync 方法

定義

擷取 SetAppAddedHostsAsync 為指定註冊新增的主機集。

public:
 virtual IAsyncOperation<IVector<AppUriHandlerHost ^> ^> ^ GetAppAddedHostsAsync() = GetAppAddedHostsAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<IVector<AppUriHandlerHost>> GetAppAddedHostsAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<IList<AppUriHandlerHost>> GetAppAddedHostsAsync();
function getAppAddedHostsAsync()
Public Function GetAppAddedHostsAsync () As IAsyncOperation(Of IList(Of AppUriHandlerHost))

傳回

SetAppAddedHostsAsync上次新增的主機集。

屬性

範例

// 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); 

備註

此集合不包含 AppxManifest 中定義的主機。

適用於

另請參閱