private void btnWatchSite_Click(object sender, EventArgs e) { if (btnWatchSite.Text == "监视") { AppStartInit.LoadErrorSiteTimer(); foreach (var errorSiteTimer in AppStartInit.ErrorSiteTimers) { errorSiteTimer.Value.TimerBackEvent += new EventHandler <WatchTimerEventArgs>(UpdateErrorSiteLvItem); errorSiteTimer.Value.TimerBack(null, null);//立即执行 } btnWatchSite.Image = Resources.stop; btnWatchSite.Text = "停止"; } else { foreach (WatchLinkTimer errorSiteTimer in AppStartInit.ErrorSiteTimers.Values) { errorSiteTimer.Stop(); } AppStartInit.ErrorSiteTimers.Clear(); btnWatchSite.Image = Resources.start; btnWatchSite.Text = "监视"; } }
private void btnStartBadLinkTimer_Click(object sender, EventArgs e) { if (btnStartBadLinkTimer.Text.Equals("开始监听")) { AppStartInit.LoadBadLinkTimer(); foreach (var linkTimer in AppStartInit.BadLinkTimers) { linkTimer.Value.TimerBackEvent += new EventHandler <WatchTimerEventArgs>(UpdateBadLinkLvItem); linkTimer.Value.TimerBack(null, null);//立即执行 } btnStartBadLinkTimer.Image = Resources.stop; btnStartBadLinkTimer.Text = "停止监听"; } else { foreach (WatchLinkTimer timer in AppStartInit.BadLinkTimers.Values) { timer.Stop(); } AppStartInit.BadLinkTimers.Clear(); btnStartBadLinkTimer.Image = Resources.start; btnStartBadLinkTimer.Text = "开始监听"; } }
private void btnWatchWebLinkUrl_Click(object sender, EventArgs e) { if (btnWatchWebLinkUrl.Text.Equals("开始检控")) { AppStartInit.LoadFriendTimer(); ; foreach (var linkTimer in AppStartInit.FriendTimers) { linkTimer.Value.TimerBackEvent += new EventHandler <WatchTimerEventArgs>(UpdateFriendLinkLvItem); linkTimer.Value.TimerBack(null, null); //点击后,立即执行 } btnWatchWebLinkUrl.Image = Resources.stop; btnWatchWebLinkUrl.Text = "停止检控"; } else { foreach (WatchLinkTimer timer in AppStartInit.FriendTimers.Values) { timer.Stop(); } AppStartInit.FriendTimers.Clear(); btnWatchWebLinkUrl.Image = Resources.start; btnWatchWebLinkUrl.Text = "开始检控"; } //MessageBox.Show(timespan.ToString()); }
private void btnStartWachUpdate_Click(object sender, EventArgs e) { if (btnStartWachUpdate.Text.Equals("开始监听")) { btnStartWachUpdate.Image = Resources.stop; btnStartWachUpdate.Text = "停止监听"; //开始监听Timer,将Timer添加到资源字典 AppStartInit.LoadUpdateLinkTimer(); foreach (var linkTimer in AppStartInit.UpdateLinkTimers) { linkTimer.Value.TimerBackEvent += new EventHandler <WatchTimerEventArgs>(UpdateLinkLvItem); linkTimer.Value.TimerBack(null, null); } } else { btnStartWachUpdate.Image = Resources.start; btnStartWachUpdate.Text = "开始监听"; //结束监听Timer foreach (WatchLinkTimer timer in AppStartInit.UpdateLinkTimers.Values) { timer.Stop(); } AppStartInit.UpdateLinkTimers.Clear(); } }