private void OpenTemplate() { var templateInfo = SelectedTemplateInfo; if (templateInfo == null) { PopupMessageHelper.Instance.ShowWarning("Please select schedule in list"); return; } using (var form = new FormScheduleName()) { form.Text = "Import Schedule Template"; if (form.ShowDialog(this) != DialogResult.OK) return; ScheduleTemplate template = null; FormProgress.ShowProgress("Loading Schedule...", () => { AsyncHelper.RunSync(async () => { template = await BusinessObjects.Instance.ScheduleTemplatesManager.GetScheduleTemplate(templateInfo.Name); template.Name = form.ScheduleName; }); }, false); BusinessObjects.Instance.ScheduleManager.AddScheduleFromTemplate(template); } DialogResult = DialogResult.OK; Close(); }
private void AddNewSchedule() { using (var form = new FormScheduleName()) { if (form.ShowDialog(this) != DialogResult.OK) return; BusinessObjects.Instance.ScheduleManager.AddSchedule(form.ScheduleName); } }