在创建文件夹时出现错误时显示弹出消息[Windows Store Javascript App]

时间:2013-07-28 06:14:01

标签: javascript windows-store-apps

如果文件夹创建失败,我试图向用户显示弹出错误消息,因为它已经存在,但access Denied exception上会抛出msg.showAsync()

sf.getFolderAsync(KorN_Name).then(function (kn) {
    return kn.createFolderAsync(username, Windows.Storage.CreationCollisionOption.failIfExists)
}).done(function (user) {

      //some code
        }, 
        function (error) {

                var md = Windows.UI.Popups.MessageDialog;
                var msg = new md("User already exists", "Ooops!");
                    msg.showAsync();
 });

如何解决?

1 个答案:

答案 0 :(得分:0)

试试这段代码。它可能会失败,因为您以不同方式初始化了messageBox:

var msg = new Windows.UI.Popups.MessageDialog("User already exists","Oops!");
msg.showAsync();

如果您还没有这样做,请参阅此link