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 注册的条目。