Skip to content

内务前端加拼音功能介绍 #1204

@DigitalPlatform

Description

@DigitalPlatform

宿主中的加拼音函数

DetailHost 类中

可用于 dp2circulation_marc_autogen.cs 脚本代码中。

(注: dp2circulation_marc_autogen.cs 中的脚本代码, 按规定必须从 DetailHost 类派生)

DetailHost 类中的 AddPinyin() 函数:

较早版本的(现在依然可用):

        /// </summary>
        /// <param name="strCfgXml">拼音配置 XML</param>
        /// <param name="bUseCache">是否使用记录中以前缓存的结果?</param>
        /// <param name="style">风格</param>
        /// <param name="strPrefix">前缀字符串。缺省为空</param>
        /// <param name="bAutoSel">是否自动选择多音字</param>
        /// <returns>-1: 出错。包括中断的情况; 0: 正常</returns>
        public virtual int AddPinyin(string strCfgXml,
            bool bUseCache = true,
            PinyinStyle style = PinyinStyle.None,
            string strPrefix = "",
            bool bAutoSel = false)

最新版本的:

        // parameters:
        //      strParameters   autoSel append useCache 的组合。分别表示是否自动选择多音字,是否在已有拼音后面追加拼音,是否使用缓存
        // return
        //      -1  出错。包括中断的情况;
        //      0   正常
        public virtual int AddPinyinExt(string strCfgXml,
    PinyinStyle style = PinyinStyle.None,
    string strPrefix = "",
    string strParameters = "")

MainForm 类中

MainForm 类中的 AddPinyin() 函数

较新版本:

        // parameters:
        //      strParameters   autoSel append 之一或者两者的组合。分别表示是否自动选择多音字,是否在已有拼音后面追加拼音
        // return
        //      -1  出错。包括中断的情况;
        //      0   正常
        public int AddPinyin(
            MarcRecord record,
            string strCfgXml,
            delegate_processPinyin func_process,
            PinyinStyle style = PinyinStyle.None,
            string strPrefix = "",
            string strParameters = "")

脚本代码

最新版 dp2library 模板中携带的 dp2circulation_marc_autogen.cs 中和加拼音有关的代码

    void AddPinyin()
    {
        AddPinyin(this.PinyinCfgXml,
            true,
            PinyinStyle.None,
            "",
            this.DetailForm.MainForm.AutoSelPinyin);
    }

效果是,自动选择拼音受到系统参数对话框的控制(“全局”-“加拼音时自动选择多音字”)。

很多老用户单位的环境下,dp2circulation_marc_autogen.cs 内容很旧了,加拼音有关的代码是

    void AddPinyin()
    {
        AddPinyin(this.PinyinCfgXml);
    }

其中负责自动选择拼音的参数缺省了,效果是不自动选择多音拼音。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions