我的要求是在另一个Universal Windows应用中执行的单击按钮后启动Universal Windows应用, 我的应用程序是使用javascript开发的。
不起作用的示例, 它可以在Windows 10桌面上正常工作,但不能在Windows IOT os上工作:
$(document).on('click', '.openDPPA', function () {
document.getElementById("demo1").innerHTML = 1;
try {
var testAppUri = new Windows.Foundation.Uri("test2-app2app:");
var n = new Windows.System.LauncherOptions();
options.TargetApplicationPackageFamilyName = "DPPAApp_ehke6zp0mbebr";
}
catch (err) {
document.getElementById("demo").innerHTML = err.message;
}
Windows.System.Launcher.launchUriAsync(testAppUri, options).then(
function (success) {
if (success) {
// URI launched
x = "success";
$("#errorLabel").html("success");
} else {
x = "failed";
$("#errorLabel").html("failed");
// URI launch failed
}
});
});
尝试将错误消息显示为
无法获取未定义或空引用的属性。
答案 0 :(得分:0)
以下代码在Windows IoT核心版中有效
$(document).on('click', '.openDPPA', function () {
try {
var testAppUri = new Windows.Foundation.Uri("test2-app2app:");
var n = new Windows.System.LauncherOptions();
options.TargetApplicationPackageFamilyName = "DPPAApp_ehke6zp0mbebr";
options.treatedAsUntrusted = false;
}
catch (err) {
document.getElementById("demo").innerHTML = err.message;
}
Windows.System.Launcher.launchUriAsync(testAppUri, options).then(
function (success) {
if (success) {
// URI launched
} else {
// URI launch failed
}
});
});