public void SaveInput(ZeusTemplate template) { bool overridden = false; if (ExecuteTemplateOverride != null) { overridden = ExecuteTemplateOverride(TemplateOperations.SaveInput, template, null, _guiHandler); } if (!overridden) { try { DefaultSettings settings = DefaultSettings.Instance; ZeusSimpleLog log = new ZeusSimpleLog(); ZeusContext context = new ZeusContext(); context.Log = log; ZeusSavedInput collectedInput = new ZeusSavedInput(); collectedInput.InputData.TemplateUniqueID = template.UniqueID; collectedInput.InputData.TemplatePath = template.FilePath + template.FileName; settings.PopulateZeusContext(context); template.Collect(context, settings.ScriptTimeout, collectedInput.InputData.InputItems); if (log.HasExceptions) { throw log.Exceptions[0]; } else { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Zues Input Files (*.zinp)|*.zinp"; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; if (saveFileDialog.ShowDialog() == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; collectedInput.FilePath = saveFileDialog.FileName; collectedInput.Save(); } } MessageBox.Show(this, "Input collected and saved to file: \r\n" + collectedInput.FilePath); } catch (Exception ex) { OnErrorsOccurred(ex); } Cursor.Current = Cursors.Default; } }
public void SaveInput(ZeusTemplate template) { try { DefaultSettings settings = DefaultSettings.Instance; ZeusSimpleLog log = new ZeusSimpleLog(); ZeusContext context = new ZeusContext(); context.Log = log; ZeusSavedInput collectedInput = new ZeusSavedInput(); collectedInput.InputData.TemplateUniqueID = template.UniqueID; collectedInput.InputData.TemplatePath = template.FilePath + template.FileName; settings.PopulateZeusContext(context); template.Collect(context, settings.ScriptTimeout, collectedInput.InputData.InputItems); if (log.HasExceptions) { throw log.Exceptions[0]; } else { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Zues Input Files (*.zinp)|*.zinp"; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; if (saveFileDialog.ShowDialog() == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; collectedInput.FilePath = saveFileDialog.FileName; collectedInput.Save(); } } MessageBox.Show(this, "Input collected and saved to file: \r\n" + collectedInput.FilePath); } catch (Exception ex) { mdi.ErrorsOccurred(ex); //ZeusDisplayError formError = new ZeusDisplayError(ex); //formError.SetControlsFromException(); //formError.ShowDialog(this); } Cursor.Current = Cursors.Default; }