我试图在有人试图关闭未保存的文件时在我的Windows RT应用程序中启动保存对话框。但是,我不断收到一个0x80070005 - JavaScript runtime error: Access is denied
错误使用Javascript的Windows Store应用程序中的访问被拒绝
这是我使用启动消息对话框的代码。当选择“不保存”(并且运行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();
}
啊!我明白你对这个流程的看法,但这里有什么选择?如果有人试图关闭文件而不保存,则标准过程是提示他们保存并显示文件选择器对话框。我没有看到围绕此流程的解决方法 – roryok
您可以通过将WinJS.promise.timeout延迟推送到选取器来解决此问题。 –
看起来好像showAsync的功能更好。我想我会像 – roryok