Esempio n. 1
0
// Zeitplan erstellen
        private void button1_Click(object sender, EventArgs e)
        {
            foreach (BackupSetInfo bs in backup.ListOfBackupSetInfo)
            {
                if (bs.BackupSchedule == "true")
                {
                    int      _H = Convert.ToInt16(bs.BackupStunde);
                    int      _M = Convert.ToInt16(bs.BackupMin);
                    int      _S = 0;
                    DateTime dt = DateTime.Now;
                    TimeSpan ts = new TimeSpan(_H, _M, _S);
                    dt = dt.Date + ts;
                    if (dt.CompareTo(DateTime.Now) <= 0)
                    {
                        dt = dt.AddDays(+1);
                    }
                    String.Format("{0:dd.MM.yyyy HH:mm}", dt);
                    Schedule s = new DailySchedule("Sicherung", dt);
                    s.OnTrigger += new EventScheduler.Invoke(ScheduleCallBack);
                    if (bs.BackupSo == "true")
                    {
                        s.SetWeekDay(DayOfWeek.Sunday, true);
                    }
                    else
                    {
                        s.SetWeekDay(DayOfWeek.Sunday, false);
                    }
                    if (bs.BackupMo == "true")
                    {
                        s.SetWeekDay(DayOfWeek.Monday, true);
                    }
                    else
                    {
                        s.SetWeekDay(DayOfWeek.Monday, false);
                    }
                    if (bs.BackupDi == "true")
                    {
                        s.SetWeekDay(DayOfWeek.Tuesday, true);
                    }
                    else
                    {
                        s.SetWeekDay(DayOfWeek.Tuesday, false);
                    }
                    if (bs.BackupMi == "true")
                    {
                        s.SetWeekDay(DayOfWeek.Wednesday, true);
                    }
                    else
                    {
                        s.SetWeekDay(DayOfWeek.Wednesday, false);
                    }
                    if (bs.BackupDo == "true")
                    {
                        s.SetWeekDay(DayOfWeek.Thursday, true);
                    }
                    else
                    {
                        s.SetWeekDay(DayOfWeek.Thursday, false);
                    }
                    if (bs.BackupFr == "true")
                    {
                        s.SetWeekDay(DayOfWeek.Friday, true);
                    }
                    else
                    {
                        s.SetWeekDay(DayOfWeek.Friday, false);
                    }
                    if (bs.BackupSa == "true")
                    {
                        s.SetWeekDay(DayOfWeek.Saturday, true);
                    }
                    else
                    {
                        s.SetWeekDay(DayOfWeek.Saturday, false);
                    }
                    Scheduler.AddSchedule(s);
                    NotiText("Meldung", "Zeitplan angelegt               ");
                }
            }
        }