为上下文菜单项添加动词不会执行任何操作。 [英] Adding Verb for context menu entry does not do anything.

查看:71
本文介绍了为上下文菜单项添加动词不会执行任何操作。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我有一个桌面应用程序,我想通过桌面应用程序转换器打包为UWP。该应用程序处理word文档,但并未真正为用户打开它们。因此,我想为docx文件添加上下文菜单条目。桌面应用程序版本通过在安装时添加注册表项来处理
。从  "将选项添加到具有特定文件类型的文件的上下文菜单"在"与Windows 10集成"[1]中,我知道我必须在appxmanifest.xml中实现它。
但是上下文菜单没有显示。这是清单中的相关部分:

I have a Desktop app which I'd like to package as an UWP via Desktop App Converter. The app processes word documents but does not really open them for the user. Therefore I'd like to add a context menu entry for docx files. The desktop app version handles this by adding a registry entry on installation. From "Add options to the context menus of files that have a certain file type" in "Integrate with Windows 10"[1], I know that I have to implement this in the appxmanifest.xml. But the context menu does not show up. This is the relevant section in the manifest:

     <Extensions>
        <uap3:Extension Category="windows.fileTypeAssociation">
            <uap3:FileTypeAssociation Name="docx" Parameters="&quot;%1&quot;">
                <uap:SupportedFileTypes>
                  <uap:FileType>.docx</uap:FileType>
                </uap:SupportedFileTypes>
                <uap2:SupportedVerbs>
                    <uap3:Verb Id="Edit" Parameters="/e &quot;%1&quot;">Edit</uap3:Verb> 
                    <uap3:Verb Id="Print" Parameters="/p &quot;%1&quot;">Print</uap3:Verb>  
                    <uap3:Verb Id="AnlagenPDF" Parameters="&quot;%1&quot;">AnlagenPDF</uap3:Verb> 
                </uap2:SupportedVerbs>
            </uap3:FileTypeAssociation>
        </uap3:Extension>  
      </Extensions>

动词"编辑"和"打印"刚刚添加进行测试,但也没有显示出来。右键单击docx文件时,它会列出"Bearbeiten"。和"Drucken"。这是"编辑"和"打印"在德国。
但这些条目只打开Word而不是我的处理应用程序。我在上下文菜单条目中找到了这篇文章[2],但它并没有告诉我一些新内容。 

The verbs "Edit" and "Print" were just added for testing but the don't show up as well. When right-clicking on a docx file it lists "Bearbeiten" and "Drucken" which is "Edit" and "Print" in German. But those entries only open Word and not my processing app. I found this article [2] on context menu entries, but it does not tell me something new. 

我的应用程序列在子菜单中"打开方式..." ;它工作正常。但这对于日常使用来说并不方便。

My app is listed in the sub menu "open with..." and it works fine. But this is not handy for daily use.

我如何将自定义动词放入上下文菜单中?

How could I get my custom Verb into the context menu?

[1]  https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-extensions#add

[1] https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-extensions#add

[ 2] https://social.msdn.microsoft.com/Forums/expression/en-US/d81ed0c7-a96a-4b47-a685-3f927fef9438/uwphow-to-add-an-item-into-windows-explorer-context-菜单?论坛= wpdevelop

[2] https://social.msdn.microsoft.com/Forums/expression/en-US/d81ed0c7-a96a-4b47-a685-3f927fef9438/uwphow-to-add-an-item-into-windows-explorer-context-menu?forum=wpdevelop

推荐答案

你好sc1max,

Hi sc1max,

请参考官方样本:< a href ="https://github.com/Microsoft/DesktopBridgeToUWP-Samples/tree/master/Samples/DesktopAppTransition">
PhotoStoreDemo 。然后,您可以
为具有特定文件类型(.docx)的文件的上下文菜单添加选项。

Please refer the official sample: PhotoStoreDemo. Then, you can add options to the context menus of files that have a certain file type(.docx).

在PhotoStoreDemo.Package-> package.appxmanifest文件中添加以下代码。安装后,如果您有默认应用程序来处理特定文件类型,则需要转到
设置 - >应用 - >默认应用 - >按文件类型选择默认应用 - >选择docx文件类型 - >首先选择您的应用作为默认应用

Add the following code in the PhotoStoreDemo.Package->package.appxmanifest file. After installation, If you have the default app to handle the certain file type, you need go to the Setting -> Apps -> Default app -> Choose default apps by file type -> choose the docx file type -> Choose your app as the default app firstly.

然后,您可以打开应用并通过这些动词快速查看文件。

Then, you can open the App and view the file quickly through these verbs.

<uap3:Extension Category="windows.fileTypeAssociation">
          <uap3:FileTypeAssociation Name="docx">
            <uap:SupportedFileTypes>
              <uap:FileType>.docx</uap:FileType>
            </uap:SupportedFileTypes>
            <uap2:SupportedVerbs>
              <uap3:Verb Id="Show" Parameters="&quot;%1&quot;">docx viewer Show</uap3:Verb>
              <uap3:Verb Id="Edit" Parameters="/e &quot;%1&quot;">docx viewer Edit</uap3:Verb>
              <uap3:Verb Id="AnlagenPDF" Parameters="&quot;%1&quot;">docx AnlagenPDF</uap3:Verb>
            </uap2:SupportedVerbs>
          </uap3:FileTypeAssociation>
        </uap3:Extension>

最好的问候,

Yong Lu


这篇关于为上下文菜单项添加动词不会执行任何操作。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆