Ejemplo n.º 1
0
        private void listBoxWordbook_DoubleClick(object sender, EventArgs e)
        {
            int index = listBoxWordbook.SelectedIndex;

            if (index >= 0)
            {
                _wordbookInfo = m_BookCollection[index];
                OnChanged(e);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 确定两个字典信息结构体是否具有相同的值
        /// </summary>
        /// <param name="obj">与当前对象比较的结构体</param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            WordbookInfo p = (WordbookInfo)obj;

            if ((object)p == null)
            {
                return(false);
            }
            // Return true if the fields match:
            return((Catalog == p.Catalog) &&
                   (Name == p.Name) &&
                   (TypeName == p.TypeName));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 通过字典名称获取对应的字典类实例
        /// </summary>
        /// <param name="name">字典类的中文(全称或分类名+字典名)</param>
        /// <returns>类名正确,返回相应实例,否则报异常</returns>
        public static BaseWordbook GetWordbookByName(string name)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(MessageStringManager.GetString("NullParameterName"));
            }


            var wordbooks = WordbookList.Where(wd => wd.Name.Equals(name));

            try
            {
                WordbookInfo info = wordbooks.First();
                return(GetWordbook(info.TypeName));
            }
            catch
            {
                return(null);
            }
        }