You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.7 KiB
C#
76 lines
1.7 KiB
C#
using HZH_Controls.Forms;
|
|
|
|
using NewLife.Threading;
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using NewLife;
|
|
|
|
namespace RfidWeb.Frm
|
|
{
|
|
public partial class UserMain : UserControl
|
|
{
|
|
|
|
TimerX _timer;
|
|
|
|
public UserMain()
|
|
{
|
|
InitializeComponent();
|
|
_timer = new TimerX(TimeState, null, 10, 1000);
|
|
|
|
}
|
|
|
|
private void ucBtnExt5_BtnClick(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void ucBtnLogin_BtnClick(object sender, EventArgs e)
|
|
{
|
|
FormLogin login = new FormLogin();
|
|
login.ShowDialog();
|
|
}
|
|
|
|
/// <summary>移除过期的缓存项</summary>
|
|
void TimeState(Object state)
|
|
{
|
|
bool isExit = UserManager.IsExit();
|
|
this.Invoke(() =>
|
|
{
|
|
//不存在
|
|
if (!isExit)
|
|
{
|
|
ucBtnLogin.BtnText = "登录";
|
|
ucBtnExt9.BtnText = "无";
|
|
}
|
|
else
|
|
{
|
|
var dto = UserManager.GetUser();
|
|
ucBtnLogin.BtnText = dto.UserName;
|
|
ucBtnExt9.BtnText = dto.RoleName;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
protected override void OnHandleDestroyed(EventArgs e)
|
|
{
|
|
base.OnHandleDestroyed(e);
|
|
// 在此添加需要手动释放资源的代码
|
|
if (null != _timer)
|
|
{
|
|
_timer.TryDispose();
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|