0

我想在“设置”超级按钮栏中添加一个名为“隐私政策”的按钮,该按钮链接到网址:

    http://yourdomain.com/privacypolicy

我正在使用 Visual Studio 和 VB 创建一个 Windows 8 应用程序

4

2 回答 2

1

在 app.xaml.cs

protected override void OnWindowCreated(WindowCreatedEventArgs args)
{
    SettingsPane.GetForCurrentView().CommandsRequested += (s, e) =>
    {
        SettingsCommand defaultsCommand = new SettingsCommand("privacy", "Privacy Policy",
            (handler) =>
            {
                //open the URL
                Launcher.LaunchUriAsync(new Uri("http://yourdomain.com/privacypolicy"));
            });
        e.Request.ApplicationCommands.Add(defaultsCommand);
    };

    base.OnWindowCreated(args);
}
于 2014-02-01T18:23:01.457 回答
0

App.xaml.vb 文件中的 vb 代码:

    Imports Windows.UI.ApplicationSettings

放置在启动的子中

    AddHandler SettingsPane.GetForCurrentView.CommandsRequested, Sub(sender, e)         e.Request.ApplicationCommands.Add(New SettingsCommand("privacy", "Online Privacy Policy", Sub() privacyGo()))

创建一个子

    Private Sub privacyGo()

    Dim privacy As New Uri("http://myprivacy.com")

    Windows.System.Launcher.LaunchUriAsync(privacy)

End Sub
于 2014-02-08T18:32:10.183 回答