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;
            }
        }
Example #2
0
        private void SaveInput()
        {
            try
            {
                if (_collectInChildProcess)
                {
                    this.buttonCollectInput.Enabled = false;
                    this.Cursor = Cursors.WaitCursor;
                    ZeusProcessManager.RecordProjectItem(this._module.RootProject.FilePath, _module.ProjectPath + "/" + SavedObject.SavedObjectName, this.SelectedTemplate.Tag.ToString(), _executionCallback);
                }
                else
                {
                    //RecordProjectItem
                    ZeusTemplate    template = new ZeusTemplate(this.SelectedTemplate.Tag.ToString());
                    DefaultSettings settings = DefaultSettings.Instance;

                    ZeusSimpleLog log     = new ZeusSimpleLog();
                    ZeusContext   context = new ZeusContext();
                    context.Log = log;

                    SavedObject.TemplateUniqueID = template.UniqueID;
                    SavedObject.TemplatePath     = template.FilePath + template.FileName;

                    settings.PopulateZeusContext(context);
                    if (_module != null)
                    {
                        _module.PopulateZeusContext(context);
                        _module.OverrideSavedData(SavedObject.InputItems);
                    }

                    if (template.Collect(context, settings.ScriptTimeout, SavedObject.InputItems))
                    {
                        this._lastRecordedSelectedNode = this.SelectedTemplate;
                    }

                    if (log.HasExceptions)
                    {
                        throw log.Exceptions[0];
                    }
                }
            }
            catch (Exception ex)
            {
                mdi.ErrorsOccurred(ex);
                //ZeusDisplayError formError = new ZeusDisplayError(ex);
                //formError.SetControlsFromException();
                //formError.ShowDialog(this);
            }

            Cursor.Current = Cursors.Default;
        }
Example #3
0
        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;
        }
Example #4
0
        private void SaveInput()
        {
            try
            {
                /*if (_lastRecordedSelectedIndex != this.listBoxTemplates.SelectedIndex)
                 * {
                 *      this.SavedObject.InputItems.Clear();
                 * }*/

                ZeusTemplate    template = new ZeusTemplate(this.SelectedTemplate.Path);
                DefaultSettings settings = DefaultSettings.Instance;

                ZeusSimpleLog log     = new ZeusSimpleLog();
                ZeusContext   context = new ZeusContext();
                context.Log = log;

                SavedObject.TemplateUniqueID = template.UniqueID;
                SavedObject.TemplatePath     = template.FilePath + template.FileName;

                settings.PopulateZeusContext(context);
                if (_module != null)
                {
                    _module.PopulateZeusContext(context);
                }

                if (template.Collect(context, settings.ScriptTimeout, SavedObject.InputItems))
                {
                    _lastRecordedSelectedIndex = this.listBoxTemplates.SelectedIndex;
                }

                if (log.HasExceptions)
                {
                    throw log.Exceptions[0];
                }
            }
            catch (Exception ex)
            {
                mdi.ErrorsOccurred(ex);
                //ZeusDisplayError formError = new ZeusDisplayError(ex);
//formError.SetControlsFromException();
//formError.ShowDialog(this);
            }

            Cursor.Current = Cursors.Default;
        }
Example #5
0
        private void SaveInput()
        {
            try
            {
                ZeusTemplate    template = new ZeusTemplate(this.SelectedTemplate.Tag.ToString());
                DefaultSettings settings = DefaultSettings.Instance;

                ZeusSimpleLog log     = new ZeusSimpleLog();
                ZeusContext   context = new ZeusContext();
                context.Log = log;

                SavedObject.TemplateUniqueID = template.UniqueID;
                SavedObject.TemplatePath     = template.FilePath + template.FileName;

                settings.PopulateZeusContext(context);
                if (_module != null)
                {
                    _module.PopulateZeusContext(context);
                }

                if (template.Collect(context, settings.ScriptTimeout, SavedObject.InputItems))
                {
                    this._lastRecordedSelectedNode = this.SelectedTemplate;
                }

                if (log.HasExceptions)
                {
                    throw log.Exceptions[0];
                }
            }
            catch (Exception ex)
            {
                ZeusDisplayError formError = new ZeusDisplayError(ex);
                formError.SetControlsFromException();
                formError.ShowDialog(this);
            }

            Cursor.Current = Cursors.Default;
        }