这是我的解决方案
页default.html中
CheckCnxInternet为default.js让它没有modifcation, 没有Appbar.js的代码
(function() {
"use strict";
var appBar;
var cx = new Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();
var page = WinJS.UI.Pages.define("default.html", {
ready: function (element, options) {
appBar = document.getElementById("createAppBar").winControl;
appBar.getCommandById("cmdAdd").addEventListener("click", doClickAdd, false);
appBar.getCommandById("cmdRemove").addEventListener("click", doClickRemove, false);
appBar.getCommandById("cmdEdit").addEventListener("click", doClickEdit, false);
appBar.getCommandById("cmdCamera").addEventListener("click", doClickCamera, false);
}
});
// Command button functions
function doClickAdd() {
WinJS.log && WinJS.log("Add button pressed", "sample", "status");
}
function doClickRemove() {
WinJS.log && WinJS.log("Remove button pressed", "sample", "status");
}
function doClickEdit() {
WinJS.log && WinJS.log("Edit button pressed", "sample", "status");
}
function doClickCamera() {
WinJS.log && WinJS.log("Camera button pressed", "sample", "status");
}
})();
我希望它有帮助:)