简体   繁体   English

退出Windows应用程序确认按钮不起作用

[英]Exit windows app confirmation button not working

I am developing a windows app with an exit button to exit the app with a confirmation. 我正在开发带有退出按钮的Windows应用程序,以确认退出该应用程序。 The button is placed on the top of the app using html5, jquery-mobile, ajax, and phonegap. 该按钮使用html5,jquery-mobile,ajax和phonegap放置在应用程序的顶部。 The problem is with me, I used the code that it's written below and is not working in windows app. 问题出在我身上,我使用了下面编写的代码,但无法在Windows应用中正常工作。 Even the alert is not working. 即使警报也不起作用。

So i used 所以我用

var msg = new Windows.UI.Popups.MessageDialog("No image is selected");
        msg.showAsync();

And it is working fine. 而且工作正常。 Can anyone help me to find the problem out? 谁能帮我找出问题所在?

 navigator.notification.confirm("Do you really want to close this app?", function (buttonIndex) {
    ConfirmExit(buttonIndex);
    },
    "Confirmation",
    "Yes,No"
);
function ConfirmExit(stat) {
alert("Inside ConfirmExit");
if (stat == "1") {
    navigator.app.exitApp();
} else {
    return;
};
};

The way you are calling the function, and the alert! 您调用函数的方式以及警报!

I haven't tried this but I think you may it a try 我没有尝试过,但是我想你可以尝试一下

  navigator.notification.confirm("Do you really want to close this app?"
       , ConfirmExit,
       "Confirmation",
       ["Yes","No"]
   );

and there is navifator.notification.alert to alert a message 并且有navifator.notification.alert提醒消息

 function ConfirmExit(stat) {
     //alert("Inside ConfirmExit");
  navigator.notification.alert("Inside ConfirmExit", null, "Alert", null)

   if (stat == "1") {
       navigator.app.exitApp();
   }
 };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM