private void frm_main_Load(object sender, EventArgs e) { timer1.Enabled = true; cbxLang.SelectedIndex = 0; label4.Text = string.Format("{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now); pnlLeft.Enabled = false; pnlLeft.Width = 1; lblArrow.Image = global::WR.Client.UI.Properties.Resources.pright; ShowForm(""); System.Threading.Tasks.Task.Factory.StartNew(() => { while (true) { try { System.Threading.Thread.Sleep(60000); //20s IsysService service = sysService.GetService(); var deviceArray = service.GetHeartBeatInterval().Select(s => s.REMARK).ToArray(); if (deviceArray.Length > 0) { var msg = string.Format("The {0} has stopped uploading, please check its status.", string.Join(",", deviceArray)); if (this.InvokeRequired) { this.BeginInvoke(new Action(() => { MsgBoxEx.Warn(msg); })); } else { MsgBoxEx.Warn(msg); } return; } } catch (Exception ex) { } } }); }