Exemplo n.º 1
0
        public bool PreFilterMessage(ref Message m)
        {
            if (m.Msg >= WM_MOUSEMOVE && m.Msg <= WM_MBUTTONDBLCLK ||
                m.Msg == WM_KEYDOWN ||
                m.Msg == WM_KEYUP)
            {
                UserActive?.Invoke(this, EventArgs.Empty);

                if (IdleTimeout != default(TimeSpan))
                {
                    _timer.Change((int)IdleTimeout.TotalMilliseconds, -1);
                }
            }
            // Always allow message to continue to the next filter control
            return(false);
        }
Exemplo n.º 2
0
        public async Task ChangeStatusAsync(long id, UserActive userActive)
        {
            LinUser user = await _userRepository.Select.Where(r => r.Id == id).ToOneAsync();

            if (user == null)
            {
                throw new LinCmsException("用户不存在", ErrorCode.NotFound);
            }

            if (user.IsActive() && userActive == UserActive.Active)
            {
                throw new LinCmsException("当前用户已处于禁止状态");
            }
            if (!user.IsActive() && userActive == UserActive.NotActive)
            {
                throw new LinCmsException("当前用户已处于激活状态");
            }

            await _userRepository.UpdateDiy.Where(r => r.Id == id)
            .Set(r => new { Active = userActive.GetHashCode() })
            .ExecuteUpdatedAsync();
        }
Exemplo n.º 3
0
        public void ChangeStatus(int id, UserActive userActive)
        {
            LinUser user = _userRepository.Select.Where(r => r.Id == id).ToOne();

            if (user == null)
            {
                throw new LinCmsException("用户不存在", ErrorCode.NotFound);
            }

            if (user.IsActive() && userActive == UserActive.Active)
            {
                throw new LinCmsException("当前用户已处于禁止状态");
            }
            if (!user.IsActive() && userActive == UserActive.NotActive)
            {
                throw new LinCmsException("当前用户已处于激活状态");
            }

            _freeSql.Update <LinUser>(id).Set(a => new LinUser()
            {
                Active = userActive.GetHashCode()
            }).ExecuteAffrows();
        }
Exemplo n.º 4
0
 public void ReportActivityEvent()
 {
     UserActive.Invoke(this, new EventArgs());
 }