private void AutoCollectTimerTick(object sender, EventArgs e) { AutoCollectTimer.Stop(); AutoCollectTimer.Tag = "Stop"; StatuLabel.Text = string.Format("当前状态:正在进行第{0}次自动采集。", ++General.Instance.collectCount); AutoCollectAsync ac = new AutoCollectAsync(); ac.StatuUpdate += StatuLabelUpdate; ac.Accomplish += AccomplishCallBack; autoCollectThread = new Thread(new ThreadStart(ac.Invoke)); autoCollectThread.IsBackground = true; autoCollectThread.Start(); }
private void OnAutoCollectButtonClick(object sender, EventArgs e) { AutoCollectAsync ac = new AutoCollectAsync(); ac.StatuUpdate += StatuLabelUpdate; StatuLabel.Text = string.Format("当前状态:自动采集已开启,下一次自动采集将于{0}启动,在此期间仍然可以手动进行采集。", General.Instance.UpdateCollectTime()); General.Instance.prevTime = DateTime.Now; General.Instance.prevTime = General.Instance.prevTime.AddMilliseconds(Setting.Default.Interval); AutoCollectTimer.Interval = Setting.Default.Interval; AutoCollectTimer.Tag = "Start"; AutoCollectTimer.Start(); StopCollectButton.Enabled = true; AutoCollectButton.Enabled = false; }