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#

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