示例#1
0
 /// <summary>
 /// When the remind timer ticks, if the updatesFound flag is set to true check if the found updates are already installed.
 /// If they are not then call the ShowUpdatesBalloonTipAndUpdateToolStrip function.
 /// </summary>
 private void RemindTimer_Tick(object sender, EventArgs e)
 {
     if (updatesFound)
     {
         foreach (Update u in updatesList)
         {
             if (UpdateFilters.IsInstalled(u.KB))
             {
                 areFoundUpdatesInstalled = true;
                 autoCheckTimer.Enabled   = true;
             }
         }
         if (!areFoundUpdatesInstalled)
         {
             autoCheckTimer.Enabled = false;
             ShowUpdatesBalloonTipAndUpdateToolStrip(updatesList);
         }
     }
 }
示例#2
0
        /// <summary>
        /// Parse updates by using the Scrape and ParseUpdates methods. Update the "last checked" menu strip entry with the current date and time.
        /// If the respective filtering checkboxes are checked filter the parsed updates.
        /// After they have been filtered, if updates are found then display a balloon tip by calling the ShowUpdatesBalloonTipAndUpdateToolStrip method.
        /// </summary>
        /// <returns>A list containing all found and filtered updates.</returns>
        public List <Update> ParseAndFilterUpdates()
        {
            try
            {
                updatesList = HTML.ParseUpdates(HTML.Scrape(StringManagement.ReplaceYearMonth(msCatalogUrlTextbox.Text)), titleRegexTextbox.Text, productRegexTextbox.Text, dateRegexTextbox.Text, idRegexTextbox.Text);
            }
            catch (WebException)
            {
                Thread.Sleep(Constants.NoInternetTimeout);
                if (IsConnectedToInternet())
                {
                    updatesList = HTML.ParseUpdates(HTML.Scrape(StringManagement.ReplaceYearMonth(msCatalogUrlTextbox.Text)), titleRegexTextbox.Text, productRegexTextbox.Text, dateRegexTextbox.Text, idRegexTextbox.Text);
                }
                else
                {
                    return(null);
                }
            }

            notifyIconMenuStrip.Items[1].Text = "Last checked: " + DateTime.Now;
            if (secOnlyCheckBox.Checked)
            {
                updatesList.RemoveAll(u => !UpdateFilters.IsSecOnly(u.Title));
            }
            if (isInstalledCheckBox.Checked)
            {
                updatesList.RemoveAll(u => UpdateFilters.IsInstalled(u.KB));
            }
            if (isCompatibleCheckBox.Checked)
            {
                updatesList.RemoveAll(u => !UpdateFilters.IsCompatible(u.Product, productFilterTextbox.Text));
            }
            ShowUpdatesBalloonTipAndUpdateToolStrip(updatesList);

            return(updatesList);
        }