[英]How to open a particular app's setting from WinUI/UWP application
It is possible to open the Settings App programmatically , there are lot of options but it does not provide details about how to open a setting for a particular app.可以以编程方式打开设置应用程序,有很多选项,但它没有提供有关如何打开特定应用程序设置的详细信息。
I have also seen that we can open a particular app's settings from start menu.我还看到我们可以从开始菜单打开特定应用程序的设置。 This may mean we can also programmatically open a particular app's settings page.
这可能意味着我们还可以以编程方式打开特定应用程序的设置页面。
Any help would be greatly appreciated.任何帮助将不胜感激。
** UPDATE ** ** 更新 **
there are lot of options but it does not provide details about how to open a setting for a particular app.
有很多选项,但它没有提供有关如何打开特定应用程序设置的详细信息。
You need register launch uri for particular app, and you can get parameter in target app's onactive method.您需要为特定应用程序注册启动 uri,并且您可以在目标应用程序的 onactive 方法中获取参数。 For example
testapp:setting
, you could get setting
string from parameter.例如
testapp:setting
,您可以从参数中获取setting
字符串。
Then call navigate method to setting page base base on the received parameter.然后调用 navigate 方法根据接收到的参数设置页面基础。 For more info please refer to Handle URI activation .
有关详细信息,请参阅处理 URI 激活。
And the other way is build jump list for the app.另一种方法是为应用程序构建跳转列表。 The jump list is a system-provided menu that appears when the user right-clicks a program in the taskbar or on the Start menu.
跳转列表是系统提供的菜单,当用户右键单击任务栏或“开始”菜单上的程序时会出现该菜单。
var jumpList = await Windows.UI.StartScreen.JumpList.LoadCurrentAsync();
// Disable the system-managed jump list group.
jumpList.SystemGroupKind = Windows.UI.StartScreen.JumpListSystemGroupKind.None;
var taskItem = JumpListItem.CreateWithArguments(
"/Setting", "Setting");
// Set the description. (Optional.)
taskItem.Description = "Compose a new message to " + "Nico";
// Set the logo for this jump list item. Must be ms-appx: or ms-appdata:.
taskItem.Logo = new Uri("ms-appx:///Assets/StoreLogo.png");
// Remove any previously added custom jump list items.
jumpList.Items.Add(taskItem);
// Save the changes to the app's jump list.
await jumpList.SaveAsync();
And you could process launch parameter.您可以处理启动参数。
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
if (e.Kind == ActivationKind.Launch && e.Arguments == "/Setting")
{
// navigate to setting page.
}
}
Update更新
You could use ms-settings:appsfeatures-app
to open current app's setting page with launcher in code behind.您可以使用
ms-settings:appsfeatures-app
打开当前应用程序的设置页面,并在代码中隐藏启动器。 But it could not use to open other app's setting content.但是不能用来打开其他应用的设置内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.