从文档 class 中删除导出脚本时不显示 UI

Don't show UI when removing export script from document class

将导出脚本添加到文档时 class 会触发 运行UI 方法并显示设置表单。删除脚本时也会发生这种情况。我想阻止它,因为没有必要。

在我的 ActionEvent 方法中,我可以为 KfxActionValue 创建一个开关。

我不想在删除脚本时显示 UI,但我想在添加脚本或编辑脚本时显示它。

如您在此处所见,文档不是很有帮助

我采用了 Sharepoint 示例和 KCEC 文本示例并创建了这个

    public KfxReturnValue ActionEvent(KfxActionValue actionID, string data1, string data2)
    {
        try
        {
            bool showUI = false;

            switch (actionID)
            {
                case KfxActionValue.KFX_REL_INDEXFIELD_INSERT:
                case KfxActionValue.KFX_REL_INDEXFIELD_DELETE:
                case KfxActionValue.KFX_REL_BATCHFIELD_INSERT:
                case KfxActionValue.KFX_REL_BATCHFIELD_DELETE:
                        showUI = true;
                        break;

                //case KfxActionValue.KFX_REL_UNDEFINED_ACTION:
                //case KfxActionValue.KFX_REL_DOCCLASS_RENAME:
                //case KfxActionValue.KFX_REL_BATCHCLASS_RENAME:
                //case KfxActionValue.KFX_REL_INDEXFIELD_RENAME:
                //case KfxActionValue.KFX_REL_BATCHFIELD_RENAME:
                //case KfxActionValue.KFX_REL_RELEASESETUP_DELETE:
                //case KfxActionValue.KFX_REL_IMPORT:
                //case KfxActionValue.KFX_REL_UPGRADE:
                //case KfxActionValue.KFX_REL_PUBLISH_CHECK:
                //case KfxActionValue.KFX_REL_START:
                //case KfxActionValue.KFX_REL_END:
                //case KfxActionValue.KFX_REL_FOLDERCLASS_INSERT:
                //case KfxActionValue.KFX_REL_FOLDERCLASS_RENAME:
                //case KfxActionValue.KFX_REL_FOLDERCLASS_DELETE:
                //case KfxActionValue.KFX_REL_TABLE_DELETE:
                //case KfxActionValue.KFX_REL_TABLE_INSERT:
                //case KfxActionValue.KFX_REL_TABLE_RENAME:
                //default:
                //    break;
            }

            if (showUI)
            {
                return RunUI();
            }

            return KfxReturnValue.KFX_REL_SUCCESS;
        }
        catch (Exception e)
        {
            setupData.LogError(e.ToString());
            throw e;
        }
    }

但我不确定这是否正确。有用。但是我在哪里可以得到更多关于它的信息呢?

你的做法是正确的。官方文档中没有关于这些动作事件的更多信息,但 Developer's Guide 中解释了基本概念(您需要一个有效的 Kofax 帐户才能下载文档)。

这是我的秘籍sheet:

  • KFX_REL_UNDEFINED_ACTION - unknown
  • KFX_REL_DOCCLASS_RENAME - renamed the associated document class(es)
  • KFX_REL_BATCHCLASS_RENAME - renamed the batch class
  • KFX_REL_INDEXFIELD_DELETE - removed an existing index
  • KFX_REL_INDEXFIELD_INSERT - added a new index field
  • KFX_REL_INDEXFIELD_RENAME - renamed an existing field
  • KFX_REL_BATCHFIELD_DELETE - removed an existing batch field
  • KFX_REL_BATCHFIELD_INSERT - added a new batch field
  • KFX_REL_BATCHFIELD_RENAME - renamed an existing field
  • KFX_REL_RELEASESETUP_DELETE - removed the Export Connector from the document class
  • KFX_REL_IMPORT - called when the batch class is imported (not tested!)
  • KFX_REL_UPGRADE - called when the user hits the "Upgrade" button (must be supported by the Export Connector)
  • KFX_REL_PUBLISH_CHECK - called when the batch class is validated or published
  • KFX_REL_START - called whenever the release (setup) script is called, for example when adding an index field
  • KFX_REL_END - called when the setup script is closed
  • KFX_REL_FOLDERCLASS_INSERT - added a new folder class
  • KFX_REL_FOLDERCLASS_RENAME - renamed an existing folder class
  • KFX_REL_FOLDERCLASS_DELETE - removed an existing folder class
  • KFX_REL_TABLE_DELETE - deleted an existing table
  • KFX_REL_TABLE_INSERT - inserted a new table
  • KFX_REL_TABLE_RENAME - renamed an existing table

请注意,某些事件将连续触发。例如,重命名批次将触发 KFX_REL_START,然后是 KFX_REL_BATCHCLASS_RENAME,最后是 KFX_REL_END。