Skip to content

Instantly share code, notes, and snippets.

@kw0006667
Created December 4, 2012 09:27
Show Gist options
  • Save kw0006667/4202158 to your computer and use it in GitHub Desktop.
Save kw0006667/4202158 to your computer and use it in GitHub Desktop.
在設定中增加兩個命令功能「首頁」和「Bing」,都是以瀏覽器開啟一個新網頁
void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
SettingsCommand urlCommand = new SettingsCommand("urlCommand", "首頁", onSettingsCommand);
args.Request.ApplicationCommands.Add(urlCommand);
SettingsCommand urlCommand_2 = new SettingsCommand("urlCommand_2", "Bing", onSettingsCommand);
args.Request.ApplicationCommands.Add(urlCommand_2);
}
void onSettingsCommand(IUICommand command)
{
switch (command.Label)
{
case "首頁":
urlCommandLink_Clicked();
break;
case "Bing":
urlCommandLink2_Clicked();
break;
default:
break;
}
}
async void urlCommandLink_Clicked()
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("http://www.dotblogs.com.tw/timchang"));
}
async void urlCommandLink2_Clicked()
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("http://bing.com"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment