我正在使用webview,并且一度导航到URi Scheme,我订阅了一个名为UnsupportedUriSchemeIdentified的事件。
答案 0 :(得分:0)
由于UWP的源代码没有浮动,我无法访问sdk,我将展示一种方法,而不是直接提供解决方案。
我认为EventArgs看起来有点像这样:
public sealed class SomeEventArgs : EventArgs
{
private readonly string address;
public Uri Uri => new Uri(address);
public SomeEventArgs(string address)
{
this.address = address;
}
}
// If the address is not formatted property,
// trying to get the `Uri` will cause an exception to be thrown:
var e = new SomeEventArgs("qwe'1231[e);");
// But, we can use to reflection to find out what private fields are,
// and possibly dug out something interesting
var fields = typeof(SomeEventArgs).GetFields(BindingFlags.NonPublic | BindingFlags.Instance)
.Select(x => new { x.Name, x.FieldType });
// Say if you find something interesting, like 'address',
// you can retrieve its value like this
var address = typeof(SomeEventArgs).GetField("address", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(e);