Exemplo n.º 1
0
 // 设置菜单加亮状态 -- 加入种次号
 void AddZhongcihao_setMenu(object sender, SetMenuEventArgs e)
 {
     Field curfield = this.DetailForm.MarcEditor.FocusedField;
     if (curfield != null && curfield.Name == "905"
         && this.DetailForm.MarcEditor.FocusedSubfieldName == 'd')
         e.Action.Active = true;
     else
         e.Action.Active = false;
 }
Exemplo n.º 2
0
 // 设置菜单加亮状态 -- 出版地
 void AddPublisher_setMenu(object sender, SetMenuEventArgs e)
 {
     Field curfield = this.DetailForm.MarcEditor.FocusedField;
     if (curfield != null && curfield.Name == "210")
         e.Action.Active = true;
     else
         e.Action.Active = false;
 }
Exemplo n.º 3
0
 // 设置菜单加亮状态 -- 905$d <-- 690$a
 void Copy690aTo905d_setMenu(object sender, SetMenuEventArgs e)
 {
     Field curfield = this.DetailForm.MarcEditor.FocusedField;
     if (curfield != null &&
                 (curfield.Name == "905" || curfield.Name == "690"))
         e.Action.Active = true;
     else
         e.Action.Active = false;
 }
Exemplo n.º 4
0
 // 设置菜单加亮状态 -- 7*2$a <-- 200$g
 void Copy200gTo7x2a_setMenu(object sender, SetMenuEventArgs e)
 {
     Field curfield = this.DetailForm.MarcEditor.FocusedField;
     if (curfield != null &&
                 (curfield.Name == "702"
                 || curfield.Name == "712"))
         e.Action.Active = true;
     else
         e.Action.Active = false;
 }
Exemplo n.º 5
0
    // 设置菜单加亮状态 -- 规整ISBN为10
    void HyphenISBN_10_setMenu(object sender, SetMenuEventArgs e)
    {
        Field curfield = this.DetailForm.MarcEditor.FocusedField;
        if (curfield == null || curfield.Name != "010")
        {
            e.Action.Active = false;
            return;
        }
        Subfield a = curfield.Subfields["a"];
        if (a == null)
        {
            e.Action.Active = false;
            return;
        }

        string strISBN = a.Value;
        if (string.IsNullOrEmpty(strISBN) == true)
        {
            e.Action.Active = false;
            return;
        }

        if (IsbnSplitter.IsIsbn13(strISBN) == true)
        {
            e.Action.Active = true;
            return;
        }

        e.Action.Active = false;
    }
Exemplo n.º 6
0
        void m_genDataViewer_SetMenu(object sender, RefreshMenuEventArgs e)
        {
            if (e.Actions == null || this.m_detailHostObj == null)
                return;

            Type classType = m_detailHostObj.GetType();

            foreach (ScriptAction action in e.Actions)
            {
                string strFuncName = action.ScriptEntry + "_setMenu";
                if (string.IsNullOrEmpty(strFuncName) == true)
                    continue;

                DigitalPlatform.Script.SetMenuEventArgs e1 = new DigitalPlatform.Script.SetMenuEventArgs();
                e1.Action = action;
                e1.sender = e.sender;
                e1.e = e.e;

                classType = m_detailHostObj.GetType();
                while (classType != null)
                {
                    try
                    {
                        // 有两个参数的成员函数
                        classType.InvokeMember(strFuncName,
                            BindingFlags.DeclaredOnly |
                            BindingFlags.Public | BindingFlags.NonPublic |
                            BindingFlags.Instance | BindingFlags.InvokeMethod
                            ,
                            null,
                            this.m_detailHostObj,
                            new object[] { sender, e1 });
                        break;
                    }
                    catch (System.MissingMethodException/*ex*/)
                    {
                        classType = classType.BaseType;
                        if (classType == null)
                            break;
                    }
                }
            }
        }
Exemplo n.º 7
0
        void m_genDataViewer_SetMenu(object sender, RefreshMenuEventArgs e)
        {
            if (e.Actions == null || this.m_detailHostObj == null)
            {
                return;
            }

            Type classType = m_detailHostObj.GetType();

            foreach (ScriptAction action in e.Actions)
            {
                string strFuncName = action.ScriptEntry + "_setMenu";
                if (string.IsNullOrEmpty(strFuncName) == true)
                {
                    continue;
                }

                DigitalPlatform.Script.SetMenuEventArgs e1 = new DigitalPlatform.Script.SetMenuEventArgs();
                e1.Action = action;
                e1.sender = e.sender;
                e1.e      = e.e;

                ScriptUtil.InvokeMember(classType,
                                        strFuncName,
                                        this.m_detailHostObj,
                                        new object[] { sender, e1 });
#if NO
                classType = m_detailHostObj.GetType();
                while (classType != null)
                {
                    try
                    {
                        // 有两个参数的成员函数
                        // 用 GetMember 先探索看看函数是否存在
                        MemberInfo [] infos = classType.GetMember(strFuncName,
                                                                  BindingFlags.DeclaredOnly |
                                                                  BindingFlags.Public | BindingFlags.NonPublic |
                                                                  BindingFlags.Instance | BindingFlags.InvokeMethod);
                        if (infos == null || infos.Length == 0)
                        {
                            classType = classType.BaseType;
                            if (classType == null)
                            {
                                break;
                            }
                            continue;
                        }

                        classType.InvokeMember(strFuncName,
                                               BindingFlags.DeclaredOnly |
                                               BindingFlags.Public | BindingFlags.NonPublic |
                                               BindingFlags.Instance | BindingFlags.InvokeMethod
                                               ,
                                               null,
                                               this.m_detailHostObj,
                                               new object[] { sender, e1 });
                        break;
                    }
                    catch (System.MissingMethodException /*ex*/)
                    {
                        classType = classType.BaseType;
                        if (classType == null)
                        {
                            break;
                        }
                    }
                }
#endif
            }
        }