private void timer1_Tick(object sender, EventArgs e) { List <Alert> alerts = AlertLogic.GetInstance().GetSysAlertsByUser(this.User); foreach (Alert a in alerts) { if (a.提醒时间 < DateTime.Now) { AlertMyForm amf = AlertMyForm.Instance(this.User, this, a); amf.Show(); } } }
public static AlertMyForm Instance(User user, MainForm owner, Alert alert) { if (instance == null) { instance = new AlertMyForm(user, owner, alert); } else { instance.User = user; instance.alert = alert; instance.Text = alert.提醒方式.ToString(); instance.label1.Text = alert.提醒项目; if (alert != null) { switch (alert.提醒方式) { case 提醒方式.系统提示: instance.button1.Text = "已阅"; break; case 提醒方式.执行流程: instance.button1.Text = "去执行"; break; case 提醒方式.审批流程: instance.button1.Text = "去审批"; break; default: break; } } } instance.BringToFront(); return(instance); }