Created
December 4, 2012 09:27
-
-
Save kw0006667/4202158 to your computer and use it in GitHub Desktop.
在設定中增加兩個命令功能「首頁」和「Bing」,都是以瀏覽器開啟一個新網頁
This file contains hidden or 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
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