Created
July 13, 2012 10:05
-
-
Save pc035860/3104034 to your computer and use it in GitHub Desktop.
Make direct command on Metro style app settings (JavaScript)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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