こんにちは、 私の最初のアプリケーションを作成して、私のウェブサイトに公開しようとしています。私は終わりですが、アプリケーションはスムーズに実行されません。私の古い質問として、GoBackのボタンを作成する方法、私は例で答えを得た。例から、GoBackボタンを使用して、私はアプリケーションに他のページを追加し続けました。最初から2〜3回、ページから戻ってきたら、スムーズに進みます。誰かがエラーや何かのためにコードをチェックすることはできますか?このページはWebviewに基づいています。 。アプリケーションが2-3回後に移動する
「方法Windows.UI.ApplicationSettings.SettingsPane.getForCurrentViewが廃止されましたSettingsPaneが廃止され、すべてのプラットフォームで動作しない可能性があります詳細については、:
は、私は、Visual Studioでこのエラーを取得しています。 。MSDNを参照してください evalのコードでは、(2)(1,7)は "
は" CSP14312は:危険な-evalのホスト定義ポリシーで ' ':インラインスクリプトリソース:リソースは、ディレクティブ' スクリプト-SRC MS-APPX' 違反しましたブロックされます。 "
すべてのプラットフォーム用のWindows 10で使用できませんにDefault.js
(function() {
"use strict";
var activation = Windows.ApplicationModel.Activation;
var app = WinJS.Application;
var nav = WinJS.Navigation;
var sched = WinJS.Utilities.Scheduler;
var ui = WinJS.UI;
var ViewManagement = Windows.UI.ViewManagement;
var ApplicationViewWindowingMode = ViewManagement.ApplicationViewWindowingMode;
var ApplicationView = ViewManagement.ApplicationView;
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
var currentview = Windows.UI.Core.SystemNavigationManager.getForCurrentView();
currentview.appViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.visible;
currentview.onbackrequested = onBackRequested;
function onBackRequested(eventArgs) {
if (WinJS.Navigation.canGoBack) {
WinJS.Navigation.back(1).done(function (successInformation) {
/*this is the success function*/
}, function (error) {
/*this is the error function*/
});
}
}
} else {
// TODO: This application was suspended and then terminated.
// To create a smooth user experience, restore application state here so that it looks like the app never stopped running.
}
nav.history = app.sessionState.history || {};
nav.history.current.initialPlaceholder = true;
// Optimize the load of the application and while the splash screen is shown, execute high priority scheduled work.
ui.disableAnimations();
var p = ui.processAll().then(function() {
return nav.navigate(nav.location || Application.navigator.home, nav.state);
}).then(function() {
return sched.requestDrain(sched.Priority.aboveNormal + 1);
}).then(function() {
ui.enableAnimations();
});
args.setPromise(WinJS.UI.processAll());
ApplicationView.preferredLaunchWindowingMode = ApplicationViewWindowingMode.fullScreen;
}
};
app.oncheckpoint = function (args) {
// TODO: This application is about to be suspended. Save any state that needs to persist across suspensions here.
// You might use the WinJS.Application.sessionState object, which is automatically saved and restored across suspension.
// If you need to complete an asynchronous operation before your application is suspended, call args.setPromise().
app.sessionState.history = nav.history;
};
app.start();
})();
Navigator.js
(function() {
"use strict";
var nav = WinJS.Navigation;
WinJS.Namespace.define("Application", {
PageControlNavigator: WinJS.Class.define(
// Define the constructor function for the PageControlNavigator.
function PageControlNavigator(element, options) {
this._element = element || document.createElement("div");
this._element.appendChild(this._createPageElement());
this.home = options.home;
this._eventHandlerRemover = [];
var that = this;
function addRemovableEventListener(e, eventName, handler, capture) {
e.addEventListener(eventName, handler, capture);
that._eventHandlerRemover.push(function() {
e.removeEventListener(eventName, handler);
});
};
addRemovableEventListener(nav, 'navigating', this._navigating.bind(this), false);
addRemovableEventListener(nav, 'navigated', this._navigated.bind(this), false);
window.onresize = this._resized.bind(this);
Application.navigator = this;
}, {
home: "",
/// <field domElement="true" />
_element: null,
_lastNavigationPromise: WinJS.Promise.as(),
_lastViewstate: 0,
// This is the currently loaded Page object.
pageControl: {
get: function() { return this.pageElement && this.pageElement.winControl; }
},
// This is the root element of the current page.
pageElement: {
get: function() { return this._element.firstElementChild; }
},
// This function disposes the page navigator and its contents.
dispose: function() {
if (this._disposed) {
return;
}
this._disposed = true;
WinJS.Utilities.disposeSubTree(this._element);
for (var i = 0; i < this._eventHandlerRemover.length; i++) {
this._eventHandlerRemover[i]();
}
this._eventHandlerRemover = null;
},
// Creates a container for a new page to be loaded into.
_createPageElement: function() {
var element = document.createElement("div");
element.setAttribute("dir", window.getComputedStyle(this._element, null).direction);
element.style.position = "absolute";
element.style.visibility = "hidden";
element.style.width = "100%";
element.style.height = "100%";
return element;
},
// Retrieves a list of animation elements for the current page.
// If the page does not define a list, animate the entire page.
_getAnimationElements: function() {
if (this.pageControl && this.pageControl.getAnimationElements) {
return this.pageControl.getAnimationElements();
}
return this.pageElement;
},
_navigated: function() {
this.pageElement.style.visibility = "";
WinJS.UI.Animation.enterPage(this._getAnimationElements()).done();
},
// Responds to navigation by adding new pages to the DOM.
_navigating: function (args) {
var newElement = this._createPageElement();
this._element.appendChild(newElement);
this._lastNavigationPromise.cancel();
var that = this;
function cleanup() {
if (that._element.childElementCount > 1) {
var oldElement = that._element.firstElementChild;
// Cleanup and remove previous element
if (oldElement.winControl) {
if (oldElement.winControl.unload) {
oldElement.winControl.unload();
}
oldElement.winControl.dispose();
}
oldElement.parentNode.removeChild(oldElement);
oldElement.innerText = "";
}
}
this._lastNavigationPromise = WinJS.Promise.as().then(function() {
return WinJS.UI.Pages.render(args.detail.location, newElement, args.detail.state);
}).then(cleanup, cleanup);
args.detail.setPromise(this._lastNavigationPromise);
},
// Responds to resize events and call the updateLayout function
// on the currently loaded page.
_resized: function (args) {
if (this.pageControl && this.pageControl.updateLayout) {
this.pageControl.updateLayout.call(this.pageControl, this.pageElement);
}
},
}
)
});
})();