当有人试图关闭尚未保存的文件时,我正在尝试在我的 Windows RT 应用程序中启动保存对话框。但是,我不断收到0x80070005 - JavaScript runtime error: Access is denied
错误消息
这是我使用启动消息对话框的代码。选择“不保存”(并BlankFile()
运行)时,所有内容都运行正常。但是,当您选择“保存文件”时,它会在尝试运行时引发访问被拒绝错误.pickSaveFileAsync()
function createNewFile()
{
if (editedSinceSave)
{
// Create the message dialog and set its content
var msg = new Windows.UI.Popups.MessageDialog("Save this file?",
"Save Changes");
// Add commands
msg.commands.append(new Windows.UI.Popups.UICommand("Don't Save",
function (command) {
BlankFile();
}));
msg.commands.append(new Windows.UI.Popups.UICommand("Save File",
function (command) {
//saveFile(true, true);
testPop("test");
}));
// Set the command that will be invoked by default
msg.defaultCommandIndex = 2;
// Show the message dialog
msg.showAsync();
}
}
function testPop(text) {
var msg = new Windows.UI.Popups.MessageDialog(text, "");
msg.showAsync();
}