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.
CaiQie/RfidWeb/Frm/UserMain.cs

76 lines
1.7 KiB
C#

2 months ago
using HZH_Controls.Forms;
using NewLife.Threading;
using System;
2 months ago
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;
2 months ago
using NewLife;
2 months ago
namespace RfidWeb.Frm
{
public partial class UserMain : UserControl
{
2 months ago
TimerX _timer;
2 months ago
public UserMain()
{
InitializeComponent();
2 months ago
_timer = new TimerX(TimeState, null, 10, 1000);
2 months ago
}
private void ucBtnExt5_BtnClick(object sender, EventArgs e)
{
}
2 months ago
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();
}
}
2 months ago
}
}