private void OnTimedEvent(Object source, EventArgs e) { bool updateNow = false; if (notifyIcon.Visible) { int daysDue = GetAutoUpdateDue(); if (daysDue != 0 && !agent.IsBusy()) { // ensure we only start a check when user is not doing anything uint idleTime = MiscFunc.GetIdleTime(); if (IdleDelay * 60 < idleTime) { AppLog.Line("Starting automatic search for updates."); updateNow = true; } else if (daysDue > GetGraceDays()) { if (LastBaloon < DateTime.Now.AddHours(-4)) { LastBaloon = DateTime.Now; notifyIcon.ShowBalloonTip(int.MaxValue, MiscFunc.fmt("Please Check For Updates"), MiscFunc.fmt("WuMgr couldn't check for updates for {0} days, please check for updates manually and resolve possible issues", daysDue), ToolTipIcon.Warning); } } } if (agent.mPendingUpdates.Count > 0) { if (LastBaloon < DateTime.Now.AddHours(-4)) { LastBaloon = DateTime.Now; notifyIcon.ShowBalloonTip(int.MaxValue, MiscFunc.fmt("New Updates found"), MiscFunc.fmt("WuMgr has found {0} new updates, please review the upates and install them", agent.mPendingUpdates), ToolTipIcon.Info); } } } if ((doUpdte || updateNow) && agent.IsActive()) { doUpdte = false; if (chkOffline.Checked) { agent.SearchForUpdates(chkDownload.Checked, chkOld.Checked); } else { agent.SearchForUpdates(dlSource.Text, chkOld.Checked); } } }