public void AddNewSchedule() { frmNewScheduleId dlg = new frmNewScheduleId(this.GetUpdateJobs()); if (dlg.ShowDialog() == DialogResult.OK) { TemplateNodeUpdateJob newJob = new TemplateNodeUpdateJob(); newJob.Settings = new ScheduleSettings(); newJob.Settings.Id = dlg.Value; newJob.Settings.StartDate = DateTime.Now; newJob.Settings.Enabled = false; UserSettingScheduleControl usc = new UserSettingScheduleControl(newJob) { Name = "UserSettingScheduleControl1" }; TabPage tabPage = new TabPage("New schedule"); tabPage.Controls.Add(usc); this.tabControl1.TabPages.Add(tabPage); this.tabControl1.SelectedTab = tabPage; } }
public List <TemplateNodeUpdateJob> GetUpdateJobs() { List <TemplateNodeUpdateJob> updateJobs = new List <TemplateNodeUpdateJob>(); if (this.NodeDefinition != null && this.NodeDefinition.TemplateNode != null) { foreach (TabPage page in tabControl1.TabPages) { UserSettingScheduleControl usc = page.Controls["UserSettingScheduleControl1"] as UserSettingScheduleControl; if (usc.job == null || usc.job.IsEmpty()) { continue; } TemplateNodeUpdateJob newJob = usc.getJob(); updateJobs.Add(newJob); } } return(updateJobs); }