Created
October 3, 2012 17:25
-
-
Save argyleink/3828450 to your computer and use it in GitHub Desktop.
Win8 WinJS Charms Bar Link
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
// tie into settings show event to append a link | |
var settingsPane = Windows.UI.ApplicationSettings.SettingsPane.getForCurrentView(); | |
settingsPane.addEventListener("commandsrequested", onCommandsRequested); | |
function onCommandsRequested(e) { | |
// create a link to the charm bar | |
var rateCommand = new Windows.UI.ApplicationSettings.SettingsCommand("Rate", "Rate This App", onRateClick); | |
e.request.applicationCommands.append(rateCommand); | |
} | |
function onRateClick(rateCommand) { | |
var uri = new Windows.Foundation.Uri("http://www.google.com"); | |
Windows.System.Launcher.launchUriAsync(uri).then( | |
function (success) { | |
if (success) | |
console.log('successful link out'); | |
else | |
console.log('failed ); | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment