我正试图让魅力酒吧在Windows 8中运行,但我找不到使用谷歌的任何东西。
我想要的是让用户通过魅力栏访问设置和隐私政策。
我准备好了:
public MainPage()
{
this.InitializeComponent();
SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
}
void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
args.Request.ApplicationCommands.Add(new SettingsCommand("commandid", "Settings", DoOperation));
}
private async void DoOperation(IUICommand command)
{
//Show the Settings or Privacy Policy HERE!
}
我不知道如何取代我的设置://在此显示设置或隐私政策!
任何帮助或代替代码样本都会很有用。
答案 0 :(得分:4)
最好将代码放在App.xaml.cs中,这是一个有效的例子:
protected async override void OnLaunched(LaunchActivatedEventArgs args)
{ /....
SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;
//before if (!rootFrame.Navigate(typeof...
}
void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
var privacy = new SettingsCommand("privacyPref", "Privacy Plicy",
(uiCommand) => { Windows.System.Launcher.LaunchUriAsync(new Uri("http://YOURURL.COM")); });
args.Request.ApplicationCommands.Add(privacy);
var preferences = new SettingsCommand("preferences", "Preferences", (handler) =>
{
var settings = new SettingsFlyout(); //Callisto extension
settings.Content = new PreferencesUserControl(); //Add New Element->User Control
settings.HeaderBrush = new SolidColorBrush(_background);
settings.Background = new SolidColorBrush(_background);
settings.HeaderText = "Preferences";
settings.IsOpen = true;
});
}
答案 1 :(得分:0)
答案 2 :(得分:0)
有很多关于设置/关于实现的问题。这是我发现的最容易的 http://blog.jerrynixon.com/2012/08/how-to-create-windows-8-settings-pane.html