我已在Windows Phone中实现了自定义协议URI方案,其中包含以下两种类型的网址:
scheme://open?url=http%3A%2F%2Fstackoverflow.com%2F%3Fparam1%3D1%26param2%3D2
scheme://open?url=http%3A%2F%2Fstackoverflow.com%2F¶m1=1¶m2=2
这两个URI在Windows Phone 8.1中的ActivatedEventArgs中都相同,并且在android / windows桌面应用程序上运行正常。在两种情况下都遵循URI参数:
scheme://open?url=http://stackoverflow.com/¶m1=1¶m2=2
以下是在URI浏览中调用的函数:
protected override void OnActivated(IActivatedEventArgs args)
{
Frame rootFrame = Window.Current.Content as Frame;
if (args.Kind == ActivationKind.Protocol)
{
var _args = args as ProtocolActivatedEventArgs;
Uri uri = _args.Uri;//same uri in both cases
}
base.OnActivated(args);
}