private void manualeToolStripMenuItem_Click(object sender, EventArgs e) { isRunMan = true; if (!isRunSch) { try { string directory = AppDomain.CurrentDomain.BaseDirectory; startToolStripMenuItem.Image = Image.FromFile(directory + "Images\\semaphore_red.png"); manualeToolStripMenuItem.Enabled = false; ReportMonNotifyIcon.ShowBalloonTip(5000, "Informazioni..", "Processo iniziato", ToolTipIcon.Info); SendMailsWorker.WorkerSupportsCancellation = true; SendMailsWorker.RunWorkerAsync(); } catch (Exception ex) { Logger.Log(ex.Message, LogType.Error); } } else { MessageBox.Show("Una sessione programmata già eseguito, si prega di interrompere prima di iniziare un'altra sessione!"); } }
private void SendMailsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (isRunMan) { isRunMan = false; } string directory = AppDomain.CurrentDomain.BaseDirectory; startToolStripMenuItem.Image = Image.FromFile(directory + "Images\\semaphore_green.png"); manualeToolStripMenuItem.Enabled = true; ReportMonNotifyIcon.ShowBalloonTip(5000, "Informazioni..", "Processo finito", ToolTipIcon.Info); }
private void ReportMonScheduler_Tick(object sender, EventArgs e) { string minutes = ConfigUtils.GetMinutes().Trim(); string hours = ConfigUtils.GetHours().Trim(); if (DateTime.Now.Minute.ToString().Trim() == minutes && DateTime.Now.Hour.ToString().Trim() == hours && DateTime.Now.Date == this._lastdate.AddDays(1).Date) { ReportMonNotifyIcon.ShowBalloonTip(5000, "Informazioni..", "Processo iniziato", ToolTipIcon.Info); SendMailsWorker.RunWorkerAsync(); } }
private void ReportMonScheduler_Tick(object sender, EventArgs e) { string minutes = ConfigUtils.GetMinutes().Trim(); string hours = ConfigUtils.GetHours().Trim(); string dayweek = DateTime.Now.DayOfWeek.ToString(); if (DateTime.Now.Minute.ToString().Trim() == minutes && DateTime.Now.Hour.ToString().Trim() == hours) { var days = ConfigUtils.GetScheduledDays(); string d = DateTime.Now.Day.ToString().Trim(); if (d.Length == 1) { d = "0" + d; } if (days.Contains(d)) { ReportMonNotifyIcon.ShowBalloonTip(5000, "Informazioni..", "Processo iniziato", ToolTipIcon.Info); SendMailsWorker.RunWorkerAsync(); } } }