This repository has been archived on 2026-05-12. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
PaintPlay/JS/Main.js
adrianvic 59426d62fb first
2023-12-21 14:33:34 -03:00

41 lines
No EOL
1.7 KiB
JavaScript

////////////////////////////////////////////////////////////
//// © Microsoft. All rights reserved. ////
////////////////////////////////////////////////////////////
/// <reference path="ViewManager.js" />
(function (AppNS) {
"use strict";
var appLayout = Windows.UI.ViewManagement.ApplicationLayout.getForCurrentView();
var viewManager = null;
function activated(e) {
var Display = Windows.Graphics.Display;
Display.DisplayProperties.autoRotationPreferences = Display.DisplayOrientations.landscape | Display.DisplayOrientations.landscapeFlipped;
if (!AppNS.Utils.isLaunched) {
window.addEventListener("keypress", Microsoft.Paint.KeyManager.keyHandler);
viewManager = new AppNS.ViewManager(document.querySelector(".main-content"), AppNS.ViewCards);
viewManager.load(AppNS.ViewNames.PaintView);
WinJS.Namespace.defineWithParent(AppNS, "Utils", {
isLaunched: true
});
}
};
appLayout.addEventListener("layoutchanged", function (event) {
// Adding this to the end of the thread queue to give the window manager a chance to reset the window data.
msSetImmediate(function () {
viewManager.changeViewsLayout(event.layout);
});
});
Windows.UI.WebUI.WebUIApplication.addEventListener("suspending", function () {
viewManager.persistViewStates();
});
document.addEventListener("DOMContentLoaded", function () {
WinJS.UI.processAll();
});
Windows.UI.WebUI.WebUIApplication.addEventListener("activated", activated);
WinJS.Application.start();
})(Microsoft.Paint);