hello, i'm trying create first application, , publish website. i'm on end, application won't run smoothly. old question, how create goback button, got answer example. example, goback button, continued add other pages application. first 2-3 times, if go page goes smoothly, 4 , next times, lags. can check code errors or something. page's based on webview.
i'm getting errors in visual studio:
"the method windows.ui.applicationsettings.settingspane.getforcurrentview has been deprecated. settingspane deprecated , might not work on platforms. more info, see msdn. eval code (2) (1,7)"
"csp14312: resource violated directive 'script-src ms-appx: 'unsafe-eval'' in host defined policy: inline script. resource blocked. "
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 success function*/ }, function (error) { /*this error function*/ }); } } } else { // todo: application suspended , terminated. // create smooth user experience, restore application state here looks app never stopped running. } nav.history = app.sessionstate.history || {}; nav.history.current.initialplaceholder = true; // optimize load of application , while splash screen 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: application suspended. save state needs persist across suspensions here. // might use winjs.application.sessionstate object, automatically saved , restored across suspension. // if need complete asynchronous operation before application 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 constructor function pagecontrolnavigator. function pagecontrolnavigator(element, options) { this._element = element || document.createelement("div"); this._element.appendchild(this._createpageelement()); this.home = options.home; this._eventhandlerremover = []; var = 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, // loaded page object. pagecontrol: { get: function () { return this.pageelement && this.pageelement.wincontrol; } }, // root element of current page. pageelement: { get: function () { return this._element.firstelementchild; } }, // function disposes page navigator , contents. dispose: function () { if (this._disposed) { return; } this._disposed = true; winjs.utilities.disposesubtree(this._element); (var = 0; < this._eventhandlerremover.length; i++) { this._eventhandlerremover[i](); } this._eventhandlerremover = null; }, // creates container new page 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 list of animation elements current page. // if page not define list, animate 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 navigation adding new pages dom. _navigating: function (args) { var newelement = this._createpageelement(); this._element.appendchild(newelement); this._lastnavigationpromise.cancel(); var = this; function cleanup() { if (that._element.childelementcount > 1) { var oldelement = that._element.firstelementchild; // cleanup , 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 resize events , call updatelayout function // on loaded page. _resized: function (args) { if (this.pagecontrol && this.pagecontrol.updatelayout) { this.pagecontrol.updatelayout.call(this.pagecontrol, this.pageelement); } }, } ) }); })();
settingspane class not available in windows 10 platforms
(https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.applicationsettings.settingspane)
to fix problem, go settings, add/remove programs , select visual studio. choosing modify option able add components have not installed. found windows phone 8.0 sdk component not installed, once installed fixed problem.
Comments
Post a Comment