mirror of
https://github.com/modernw/App-Installer-For-Windows-8.x-Reset.git
synced 2026-06-17 04:40:10 +10:00
Update about Manager.
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
global.publicRes = function(resId) {
|
||||
return getFileResPair(respath, resId);
|
||||
}
|
||||
global.stringRes = function(resId) {
|
||||
return Bridge.External.StringResources.getString(resId);
|
||||
}
|
||||
|
||||
function ready(e) {
|
||||
function nextstep() {
|
||||
|
||||
@@ -124,5 +124,100 @@
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function initLoaderPage() {
|
||||
var page = document.getElementById("page-load");
|
||||
var prefixs = ["ins", "reg", "sta"];
|
||||
var opdict = {
|
||||
ins: Package.manager.add,
|
||||
reg: Package.manager.register,
|
||||
sta: Package.manager.stage
|
||||
};
|
||||
var ingdict = {
|
||||
ins: strres.get("MANAGER_LOAD_INSTALL_ING"),
|
||||
reg: strres.get("MANAGER_LOAD_REGISTER_ING"),
|
||||
sta: strres.get("MANAGER_LOAD_STAGE_ING")
|
||||
};
|
||||
var sdict = {
|
||||
ins: strres.get("MANAGER_LOAD_INSTALL_SUCCEED"),
|
||||
reg: strres.get("MANAGER_LOAD_REGISTER_SUCCEED"),
|
||||
sta: strres.get("MANAGER_LOAD_STAGE_SUCCEED")
|
||||
}
|
||||
var explorer = external.Storage.Explorer;
|
||||
prefixs.forEach(function(prefix) {
|
||||
var checklist = document.getElementById(prefix + "-deployoptions");
|
||||
var btn = document.getElementById(prefix + "-btn");
|
||||
var statusbar = document.getElementById(prefix + "-progress");
|
||||
var progressbar = statusbar.querySelector(".progress");
|
||||
var status = statusbar.querySelector(".status");
|
||||
progressbar.removeAttribute("value");
|
||||
status.textContent = "";
|
||||
var hideTimer = null;
|
||||
btn.onclick = function() {
|
||||
var self = this;
|
||||
self.disabled = true;
|
||||
var nextNextStep = function(statusbar) {
|
||||
if (hideTimer) clearTimeout(hideTimer);
|
||||
hideTimer = setTimeout(function() {
|
||||
hideTimer = null;
|
||||
statusbar.bar.hide();
|
||||
}, 10000);
|
||||
}
|
||||
var nextStep = function(filename) {
|
||||
if (filename === "" || filename === null || filename === void 0) {
|
||||
self.disabled = false;
|
||||
return;
|
||||
}
|
||||
if (hideTimer) clearTimeout(hideTimer);
|
||||
var op = opdict[prefix];
|
||||
var options = 0;
|
||||
var items = checklist.querySelectorAll("input:checked");
|
||||
if (items) {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
options |= parseInt(items[i].value);
|
||||
}
|
||||
}
|
||||
progressbar.removeAttribute("value");
|
||||
status.textContent = external.String.format(ingdict[prefix], "");
|
||||
statusbar.bar.show();
|
||||
op(filename, options).then(function(result) {
|
||||
self.disabled = false;
|
||||
status.textContent = sdict[prefix];
|
||||
refreshAppList2();
|
||||
nextNextStep(statusbar);
|
||||
}, function(error) {
|
||||
self.disabled = false;
|
||||
status.textContent = error.message;
|
||||
nextNextStep(statusbar);
|
||||
}, function(_p) {
|
||||
status.textContent = external.String.format(ingdict[prefix], _p + "%");
|
||||
progressbar.value = _p;
|
||||
});
|
||||
}
|
||||
|
||||
if (prefix === "ins" || prefix === "sta") explorer.file(
|
||||
external.String.format("{0}|{1}|{2}|{3}",
|
||||
strres.get("MANAGER_LOAD_INS_OR_STA_FILTERDISPLAY"),
|
||||
"*.appx;*.appxbundle;*.msix;*.msixbundle",
|
||||
strres.get("MANAGER_LOAD_ALLFILES"),
|
||||
"*.*"
|
||||
),
|
||||
"",
|
||||
nextStep
|
||||
);
|
||||
else if (prefix === "reg") explorer.file(
|
||||
external.String.format("{0}|{1}|{2}|{3}",
|
||||
strres.get("MANAGER_LOAD_REG_FILTERDISPLAY"),
|
||||
"*.appxmanifest;AppxManifest.xml",
|
||||
strres.get("MANAGER_LOAD_ALLFILES"),
|
||||
"*.*"
|
||||
),
|
||||
"",
|
||||
nextStep
|
||||
);
|
||||
};
|
||||
});
|
||||
}
|
||||
global.setAppInfoPageContent = setAppInfoPageContent;
|
||||
global.initLoaderPage = initLoaderPage;
|
||||
})(this);
|
||||
@@ -1,5 +1,7 @@
|
||||
(function(global) {
|
||||
var strres = external.StringResources;
|
||||
var conf = external.Config.current;
|
||||
var set = conf.getSection("Settings");
|
||||
|
||||
function createLocalizedCompare(locale) {
|
||||
return function(a, b) {
|
||||
@@ -359,6 +361,8 @@
|
||||
}
|
||||
var showSystemApps = document.getElementById("applist-showsystemapp");
|
||||
var showFrameworks = document.getElementById("applist-showframework");
|
||||
showSystemApps.checked = set.getKey("PackageManager:ShowSystemApps").readBool(false);
|
||||
showFrameworks.checked = set.getKey("PackageManager:ShowFrameworks").readBool(false);
|
||||
listView.filter = function(item) {
|
||||
try {
|
||||
if (!showFrameworks.checked && item.Properties.Framework) return false;
|
||||
@@ -371,10 +375,12 @@
|
||||
Windows.UI.Event.Util.addEvent(showSystemApps, "change", function() {
|
||||
listView.refresh();
|
||||
dataLengthDisplay.textContent = external.String.format(strres.get("MANAGER_MANAGE_FINDAPPS"), listView.findItemLength);
|
||||
set.getKey("PackageManager:ShowSystemApps").set(showSystemApps.checked);
|
||||
});
|
||||
Windows.UI.Event.Util.addEvent(showFrameworks, "change", function() {
|
||||
listView.refresh();
|
||||
dataLengthDisplay.textContent = external.String.format(strres.get("MANAGER_MANAGE_FINDAPPS"), listView.findItemLength);
|
||||
set.getKey("PackageManager:ShowFrameworks").set(showFrameworks.checked);
|
||||
});
|
||||
refreshButton.addEventListener("click", refreshAppList2);
|
||||
appbarControl.add(refreshButton);
|
||||
@@ -408,12 +414,60 @@
|
||||
launchButton.textContent = strres.get("MANAGER_APP_LAUNCH");
|
||||
launchButton.setAttribute("data-app-user-model-id", item.AppUserModelID);
|
||||
var createShortcutButton = document.createElement("button");
|
||||
createShortcutButton.textContent = strres.get("MANAGER_APP_CREATESHORTCUT");
|
||||
createShortcutButton.setAttribute("data-app-user-model-id", item.AppUserModelID);
|
||||
createShortcutButton.textContent = strres.get("MANAGER_APP_SHORTCUTCREATE_TITLE");
|
||||
createShortcutButton.style.marginRight = "10px";
|
||||
Windows.UI.Event.Util.addEvent(launchButton, "click", function(e) {
|
||||
e.stopPropagation();
|
||||
Package.manager.active(this.getAttribute("data-app-user-model-id"));
|
||||
});
|
||||
Windows.UI.Event.Util.addEvent(createShortcutButton, "click", function(e) {
|
||||
e.stopPropagation();
|
||||
var backid =
|
||||
messageBoxAdvance(function() {
|
||||
var ring = document.createElement("progress");
|
||||
ring.classList.add("win-ring");
|
||||
ring.style.color = "white";
|
||||
var text = document.createElement("span");
|
||||
text.textContent = strres.get("MANAGER_APP_SHORTCUTCREATE_BACK_TEXT_ING");
|
||||
text.style.marginLeft = "20px";
|
||||
var container = document.createElement("div");
|
||||
container.style.display = "flex";
|
||||
container.style.flexDirection = "row";
|
||||
container.appendChild(ring);
|
||||
container.appendChild(text);
|
||||
container.style.marginTop = "10px";
|
||||
var openInstallLocation = document.createElement("button");
|
||||
openInstallLocation.textContent = strres.get("MANAGER_APP_SHORTCUTCREATE_OPENINSTALLLOCATION");
|
||||
openInstallLocation.style.marginTop = "10px";
|
||||
openInstallLocation.style.display = "block";
|
||||
openInstallLocation.setAttribute("data-install-location", appDetailPage.data.InstallLocation);
|
||||
openInstallLocation.onclick = function() {
|
||||
external.Storage.Path.open(this.getAttribute("data-install-location"));
|
||||
};
|
||||
var finalc = document.createElement("div");
|
||||
finalc.appendChild(container);
|
||||
finalc.appendChild(document.createElement("br"));
|
||||
finalc.appendChild(openInstallLocation);
|
||||
return finalc;
|
||||
}(), strres.get("MANAGER_APP_SHORTCUTCREATE_BACK_TITLE"), [], "#159d9d");
|
||||
document.getElementById(backid).querySelector(".notice-controls").style.display = "none";
|
||||
var back = document.getElementById(backid);
|
||||
external.createAppShortcut(appDetailPage.data.InstallLocation, this.getAttribute("data-app-user-model-id"), function(complete) {
|
||||
complete = JSON.parse(complete);
|
||||
if (typeof back.remove !== "undefined") back.remove();
|
||||
else if (typeof back.removeNode !== "undefined") back.removeNode(true);
|
||||
else back.parentNode.removeChild(back);
|
||||
if (complete.succeeded) messageBoxAdvance(strres.get("MANAGER_APP_SHORTCUTCREATE_BACK_TEXT_SUCCEED"), strres.get("MANAGER_APP_SHORTCUTCREATE_BACK_TITLE_SUCCEED"), [], "#159d9d");
|
||||
else messageBoxAdvance(complete.message, strres.get("MANAGER_APP_SHORTCUTCREATE_BACK_TITLE_FAILED"), [], "#159d9d");
|
||||
}, function(error) {
|
||||
error = JSON.parse(error);
|
||||
if (typeof back.remove !== "undefined") back.remove();
|
||||
else if (typeof back.removeNode !== "undefined") back.removeNode(true);
|
||||
else back.parentNode.removeChild(back);
|
||||
messageBoxAdvance((error.message || error.error || error), strres.get("MANAGER_APP_SHORTCUTCREATE_BACK_TITLE_FAILED"), [], "#159d9d");
|
||||
});
|
||||
});
|
||||
ctrls.appendChild(launchButton);
|
||||
ctrls.appendChild(createShortcutButton);
|
||||
return appItem;
|
||||
@@ -536,10 +590,12 @@
|
||||
});
|
||||
uninstallFlyout.appDataSource = new DataView.DataSource();
|
||||
uninstallFlyout.appListView.bind(uninstallFlyout.appDataSource);
|
||||
initLoaderPage();
|
||||
pagemgr.addEventListener("load", function(e) {
|
||||
appbarControl.enabled = e == "manager";
|
||||
refreshButton.style.display = e == "manager" ? "" : "none";
|
||||
});
|
||||
pagemgr.register("load", document.getElementById("tag-load"), document.getElementById("page-load"));
|
||||
pagemgr.go("manager");
|
||||
});
|
||||
})(this);
|
||||
@@ -187,4 +187,32 @@
|
||||
}
|
||||
};
|
||||
}
|
||||
})();
|
||||
})();
|
||||
(function(global) {
|
||||
"use strict";
|
||||
if (typeof Array.prototype.forEach === "undefined") {
|
||||
Array.prototype.forEach = function(callback, thisArg) {
|
||||
var T, k;
|
||||
if (this == null) {
|
||||
throw new TypeError(" this is null or not defined");
|
||||
}
|
||||
var O = Object(this);
|
||||
var len = O.length >>> 0;
|
||||
if (typeof callback !== "function") {
|
||||
throw new TypeError(callback + " is not a function");
|
||||
}
|
||||
if (arguments.length > 1) {
|
||||
T = thisArg;
|
||||
}
|
||||
k = 0;
|
||||
while (k < len) {
|
||||
var kValue;
|
||||
if (k in O) {
|
||||
kValue = O[k];
|
||||
callback.call(T, kValue, k, O);
|
||||
}
|
||||
k++;
|
||||
}
|
||||
};
|
||||
}
|
||||
})(this);
|
||||
@@ -14,10 +14,12 @@
|
||||
var byId = el.getAttribute('data-res-byid');
|
||||
var fromFile = el.getAttribute('data-res-fromfile');
|
||||
var byXml = el.getAttribute('data-res-resxml');
|
||||
var customSet = el.getAttribute('data-res-custom');
|
||||
if ((byName && !Bridge.NString.empty(byName)) ||
|
||||
(byId && parseInt(byId, 10) > 0) ||
|
||||
(fromFile && !Bridge.NString.empty(fromFile)) ||
|
||||
(byXml && !Bridge.NString.empty(byXml))) {
|
||||
(byXml && !Bridge.NString.empty(byXml)) ||
|
||||
(customSet && !Bridge.NString.empty(customSet))) {
|
||||
result.push(el);
|
||||
}
|
||||
}
|
||||
@@ -55,12 +57,23 @@
|
||||
try {
|
||||
var obj = nodes[i].getAttribute('data-res-resxml');
|
||||
var strres = external.StringResources;
|
||||
if (strres && strres.isValid) {
|
||||
nodes[i].textContent = strres.get(obj);
|
||||
if (strres) {
|
||||
try {
|
||||
nodes[i].textContent = strres.get(obj);
|
||||
} catch (e) {
|
||||
nodes[i].textContent = strres.getString(obj);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
nodes[i].textContent = "";
|
||||
}
|
||||
} else if (nodes[i].hasAttribute('data-res-custom')) {
|
||||
try {
|
||||
var obj = eval(nodes[i].getAttribute('data-res-custom'));
|
||||
nodes[i].textContent = obj;
|
||||
} catch (e) {
|
||||
nodes[i].textContent = "";
|
||||
}
|
||||
} else {
|
||||
nodes[i].textContent = "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user