private void doUpdate() { parsing = new Parsing(); notifyIcon1.BalloonTipText = "Prüfe Noten"; notifyIcon1.ShowBalloonTip(10000); TimeSpan lastCheck = DateTime.Now.Subtract(Settings.Default.lastupdated); if (lastCheck.TotalMinutes > 10) { parsing.login(Settings.Default.matrikelnummer, Settings.Default.passwort); } parsing.pullNotes(); semester = parsing.parse(); checkForUpdates(semester); Settings.Default.semester = semester; Settings.Default.Save(); }
private void Form1_Load(object sender, EventArgs e) { parsing = new Parsing(); t1 = new Timer(); t1.Interval = 300000; t1.Tick += new EventHandler(checkForUpdate); if (checkBox1.Checked) t1.Start(); notifyIcon1.Visible = true; tb_username.Text = Settings.Default.matrikelnummer; tb_password.Text = Settings.Default.passwort; cb_sendemail.Checked = Settings.Default.sendemail; checkBox1.Checked = Settings.Default.checking; tb_mail_user.Text = Settings.Default.email_user; tb_mail_pass.Text = Settings.Default.email_pass; tb_mail_to.Text = Settings.Default.email_to; noteChanged = false; if (cb_sendemail.Checked) { tabControl1.Enabled = true; } else { tabControl1.Enabled = false; } }
public static void TimeCallBack(object o) { Parsing parser = new Parsing(); Console.WriteLine("{0} - Checked Notes", DateTime.Now); if (currentSemester == null) { parser.login("XXX", "XXX"); parser.pullNotes(); currentSemester = parser.parse(); } else { parser.login("XXX", "XXX"); parser.pullNotes(); Semester newSemester = parser.parse(); checkForUpdates(newSemester, currentSemester); if (noteChanged) { string subject = "RFH - Neue Note eingetragen!"; StringBuilder emailBody = new StringBuilder(); emailBody.Append(currentSemester + Environment.NewLine); foreach (Note note in currentSemester.noten) { if (note.changed) { emailBody.Append(note.modulbezeichnung + " : " + note.note + Environment.NewLine); note.changed = false; } } string body = emailBody.ToString(); SendMail("*****@*****.**", "*****@*****.**", "", body, subject); } } }