示例#1
0
        /// <summary>
        /// 清楚热键
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool ClearHotKey(int id)
        {
            var entity = new HotKeyEntity(id)
            {
                KeyVal = Keys.None, Modifier = KeyModifiers.None
            };

            return(_dao.Update(entity));
        }
示例#2
0
        public bool Update(HotKeyEntity entity)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append($"update {__TableName} set ");
            sql.Append($"{__KeyVal}={(int)entity.KeyVal},");
            sql.Append($"{__Modifier}={(int)entity.Modifier}");
            sql.Append(" where ");
            sql.Append($"{__Id}={entity.Id}");

            return(DB.ExecuteNonQuery(sql.ToString()) > 0);
        }
示例#3
0
        public bool IsExist(HotKeyEntity entity)
        {
            string sql = $"select count(*) from {__TableName} where {__Id}!={entity.Id}" +
                         $" and {__KeyVal}={(int)entity.KeyVal} and {__Modifier}={(int)entity.Modifier}";
            var result = DB.ExecuteScalar(sql);

            if (result.ToInt16() > 0)
            {
                return(true);
            }
            return(false);
        }
示例#4
0
        /// <summary>
        /// 保存自定义热键
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool SaveCustomHotKey(HotKeyEntity entity)
        {
            bool ret = _dao.Update(entity);

            if (ret)
            {
                HhForm[] forms = _registedForms.ToArray();
                foreach (var item in forms)
                {
                    item.RefreshHotKeys();
                }
            }
            return(ret);
        }
示例#5
0
        /// <summary>
        /// 注册热键
        /// </summary>
        /// <param name="form"></param>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool Regist(HhForm form, HotKeyEntity entity)
        {
            bool ret = entity.Regist(form.Handle);

            if (ret)
            {
                if (!_registedForms.Contains(form))
                {
                    _registedForms.Add(form);
                }
                _keyMap[entity.Id] = entity;
            }
            return(ret);
        }
示例#6
0
 /// <summary>
 /// 热键是否已使用
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool IsHotKeyExist(HotKeyEntity entity)
 {
     return(_dao.IsExist(entity));
 }