Vb.net 将项目添加到Windows 8设置魅力栏
我想在“设置魅力”栏中添加一个名为“隐私政策”的按钮,该按钮链接到url:Vb.net 将项目添加到Windows 8设置魅力栏,vb.net,windows-8,hyperlink,privacy,charms-bar,Vb.net,Windows 8,Hyperlink,Privacy,Charms Bar,我想在“设置魅力”栏中添加一个名为“隐私政策”的按钮,该按钮链接到url: http://yourdomain.com/privacypolicy 我正在app.xaml.cs中使用visual studio和VB创建Windows 8应用程序 protected override void OnWindowCreated(WindowCreatedEventArgs args) { SettingsPane.GetForCurrentView().CommandsReques
http://yourdomain.com/privacypolicy
我正在app.xaml.cs中使用visual studio和VB创建Windows 8应用程序
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);
}
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
我在创建项目时使用了Visual Basic项目模板而不是C#项目模板,因此我没有App.xaml.cs-我只有App.xaml.vb。对不起,是我的错。但是为VB重写代码应该不会那么难!试试看。这就是我现在得到的:“错误1”公共事件设置span()是一个事件,不能直接调用。使用'RaiseEvent'语句引发事件'