Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make direct command on Metro style app settings (JavaScript)
(function () {
var standard_commands,
special_commands;
standard_commands = {
game: {title: 'game settings'}
};
special_commands = {
popup: {title: 'go Facebook.com', cmd: function () {
window.open('http://www.facebook.com');
}}
};
WinJS.Application.onsettings = function (e) {
// populate standard commands
e.detail.applicationcommands = standard_commands;
WinJS.UI.SettingsFlyout.populateSettings(e);
// populate special commands -> extract from BingFinance app
var appSettings = Windows.UI.ApplicationSettings,
vector = e.detail.e.request.applicationCommands;
for (var key in special_commands) {
var entry = special_commands[key],
cmd = new appSettings.SettingsCommand(key, entry.title, entry.command);
vector.append(cmd);
}
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment