将项目添加到Windows 8设置超级按钮栏

时间:2014-02-01 17:36:47

标签: vb.net windows-8 hyperlink privacy charms-bar

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

    http://yourdomain.com/privacypolicy

我正在使用visual studio和VB

创建一个Windows 8应用程序

2 个答案:

答案 0 :(得分: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);
}

答案 1 :(得分:0)

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

    Imports Windows.UI.ApplicationSettings

放入onlaunched sub

    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