/// <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)); }
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); }
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); }
/// <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); }
/// <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); }
/// <summary> /// 热键是否已使用 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool IsHotKeyExist(HotKeyEntity entity) { return(_dao.IsExist(entity)); }