public void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { DateTime current = DateTime.Now; //Setting the time to 7PM if ((current.Hour == 7 && current.Minute == 30 && current.Second == 00) || (current.Hour < 00 && current.Minute == 0 && current.Second == 0)) { //MessageBox.Show("Reports have been generated.", "Check Notifications", MessageBoxButtons.OK, MessageBoxIcon.Information); file = Utilities3.generatePDF(); //Generates the pdf at 7PM (Or between 7PM and 12Midnight) and saves it in local computer. Utilities3.sendEmail(file); //Sends the file to a given location (Location is specified at sendEmail() method. //file is a String where it comprises of the location (Address) where the generated PDF is located. You can change it in generatePDF() method. //check out sendEmail(String file) for more information. try { //Thread managements. Have doubts on this. UpdateMessageBox upd = UpdateTheMessageBox; Invoke(upd); } catch (Exception ex) { //MessageBox.Show(ex.ToString()); } } }
private void CheckUpdate() { if (!UpdateMessageBox.DontShow && !UpdateMessageBox.IsOpen) { UpdateChecker updateChecker = CreateUpdateChecker(); updateChecker.CheckUpdate(); if (UpdateMessageBox.Start(updateChecker, firstUpdateCheck) != DialogResult.Yes) { TimeSpan interval = TimeSpan.FromHours(24); updateTimer.Change(interval, interval); } firstUpdateCheck = false; } }
private void CheckUpdate() { UpdateChecker updateChecker = AboutBox.CheckUpdate(); UpdateMessageBox.Start(updateChecker); }