简体   繁体   English

UWP快捷键以运行应用

[英]UWP key shortcut to run app

I am currently swimming (drowning) into the MSDN, searching for an anwser for this problem : 我目前正在(潜入)MSDN,以寻找有关此问题的答案:

Like OneNote, I want my Universal Windows App to listen to a shortcut. 像OneNote一样,我希望我的Universal Windows App能够监听快捷方式。 Then run something, and display results. 然后运行一些东西,并显示结果。

So I found this about Launching, resuming, and background tasks But I couldn't find something about listening to keyboards shortcuts. 因此,我发现了有关启动,恢复和后台任务的内容,但是找不到关于监听键盘快捷键的内容。

So I searched among classes, and found the BackgroundTaskBuilder Class . 因此,我在类之间进行搜索,然后找到BackgroundTaskBuilder类 But it looks like the SetTrigger Method[1] doesn't register shortcuts. 但是,看起来SetTrigger方法[1]没有注册快捷方式。

There's also this thing of Launching an app for results [2]. 启动结果应用程序[2]也有这件事。 I can't realize how it can help me. 我不知道它如何能帮助我。

I know how to listen to shortcuts when I am focusing the window of my program, BUT how can I do that when I am not ? 当我聚焦程序窗口时,我知道如何收听快捷方式,但是当我不在时,该如何做呢? I think it has to be a service running in background, and listening to that shortcut event. 我认为它必须是在后台运行并监听该快捷方式事件的服务。 But I can't find that in the doc... 但是我在文档中找不到...

I would appreciate some help and suggestions, thank you guys 谢谢您的帮助和建议,谢谢

[1] : msdn.microsoft.com/fr-fr/library/windows/apps/xaml/windows.applicationmodel.background.backgroundtaskbuilder.aspx?cs-save-lang=1&cs-lang=javascript#code-snippet-1 [1]:msdn.microsoft.com/fr-fr/library/windows/apps/xaml/windows.applicationmodel.background.backgroundtaskbuilder.aspx?cs-save-lang = 1&cs-lang = javascript#code-snippet-1

[2]: msdn.microsoft.com/en-us/library/windows/apps/xaml/mt269386.aspx [2]:msdn.microsoft.com/zh-CN/library/windows/apps/xaml/mt269386.aspx

No way to do this with the current SDK. 当前的SDK无法执行此操作。 You can only manually add shortcut to your app to the desktop and taskbar and set it to be launched with a shortcut, like any other Windows app. 您只能手动将应用程序的快捷方式添加到桌面和任务栏,并将其设置为使用快捷方式启动,就像其他任何Windows应用程序一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM