예제 #1
0
 private void acceptButton_Click(object sender, RoutedEventArgs e)
 {
     if (!running)
     {
         if (LogYN.IsChecked == true)
         {
             writeToFile = true;
         }
         else
         {
             writeToFile = false;
         }
         osoite             = PageURL.Text;
         lineLength         = 53 + osoite.Length;
         contentToBeChecked = FetchContent.GetPageHash(osoite);
         int timeInt = Convert.ToInt32(AikaVali.Text);
         this.ValueMultiplier();
         _timer          = new System.Windows.Threading.DispatcherTimer();
         _timer.Interval = TimeSpan.FromMilliseconds(multiplier * timeInt);
         _timer.Tick    += _timerTick;
         _timer.Start();
         running = true;
         AcceptButton.Content = "Stop";
         LogYN.IsEnabled      = false;
     }
     else
     {
         StopTimer();
     }
     this.nIcon.Icon    = new Icon("hippo.ico");
     this.nIcon.Visible = true;
 }
예제 #2
0
 private void _timerTick(object sender, EventArgs e)
 {
     if (FetchContent.GetPageHash(osoite) != contentToBeChecked)
     {
         string message = osoite + " was checked at " + DateTime.Now.ToString("h:mm:ss tt") + " and the site has updates \n";
         SiteLog.Text += message;
         if (writeToFile)
         {
             WriteLogs(message);
         }
         this.nIcon.ShowBalloonTip(5000, osoite, "Changes have been found", ToolTipIcon.Info);
         StopTimer();
     }
     else
     {
         string message = osoite + " was checked at " + DateTime.Now.ToString("h:mm:ss tt") + " and there was no changes \n";
         SiteLog.Text += message;
         if (writeToFile)
         {
             WriteLogs(message);
         }
         lines++;
         if (lines > 15)
         {
             SiteLog.Text = SiteLog.Text.Substring(lineLength, SiteLog.Text.Length - lineLength);
         }
     }
     SiteLog.ScrollToEnd();
 }