AppUriHandlerRegistration.SetAppAddedHostsAsync 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
除了 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
參數
要註冊的 AppUriHandlerHost 物件集合。
傳回
表示非同步動作。
- 屬性
範例
// 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);
備註
此 API 不會覆寫、取代或移除透過 AppxManifest 註冊的專案。