示例#1
0
        private bool ExecuteTemplateOverride(TemplateOperations operation, ZeusTemplate template, ZeusSavedInput input, ShowGUIEventHandler guiEventHandler)
        {
            switch (operation)
            {
            case TemplateOperations.Execute:
                this._mdi.PerformMdiFuntion(this, "ExecutionQueueStart");
                ZeusProcessManager.ExecuteTemplate(template.FullFileName, _executionCallback);
                break;

            case TemplateOperations.ExecuteLoadedInput:
                this._mdi.PerformMdiFuntion(this, "ExecutionQueueStart");
                ZeusProcessManager.ExecuteSavedInput(input.FilePath, _executionCallback);
                break;

            case TemplateOperations.SaveInput:
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter           = "Zues Input Files (*.zinp)|*.zinp";
                saveFileDialog.FilterIndex      = 0;
                saveFileDialog.RestoreDirectory = true;
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    this._mdi.PerformMdiFuntion(this, "ExecutionQueueStart");
                    ZeusProcessManager.RecordTemplateInput(template.FullFileName, saveFileDialog.FileName, _executionCallback);
                }
                break;
            }
            return(true);
        }
示例#2
0
        public void Execute()
        {
            this.Save();
            ZeusProject proj = this._rootNode.Project;

            Cursor.Current = Cursors.WaitCursor;

            TreeNode        node     = this.treeViewProject.SelectedNode;
            DefaultSettings settings = DefaultSettings.Instance;

            if (node is ProjectTreeNode)
            {
                OnExecutionStarted();
                ZeusProcessManager.ExecuteProject(proj.FilePath, ExecutionCallback);
            }
            else if (node is ModuleTreeNode)
            {
                ZeusModule module = node.Tag as ZeusModule;
                OnExecutionStarted();
                ZeusProcessManager.ExecuteModule(proj.FilePath, module.ProjectPath, ExecutionCallback);
                //module.Execute(settings.ScriptTimeout, log);
            }
            else if (node is SavedObjectTreeNode)
            {
                SavedTemplateInput savedinput = node.Tag as SavedTemplateInput;
                ZeusModule         module     = node.Parent.Tag as ZeusModule;
                OnExecutionStarted();
                ZeusProcessManager.ExecuteProjectItem(proj.FilePath, module.ProjectPath + "/" + savedinput.SavedObjectName, ExecutionCallback);
                //savedinput.Execute(settings.ScriptTimeout, log);
            }
        }
示例#3
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;
        }
示例#4
0
        private void MyGenerationMDI_FormClosing(object sender, FormClosingEventArgs e)
        {
            var allowPrevent = true;
            var allowSave    = true;

            if (e.CloseReason == CloseReason.TaskManagerClosing)
            {
                allowSave = false;
            }
            else if (e.CloseReason == CloseReason.WindowsShutDown ||
                     e.CloseReason == CloseReason.ApplicationExitCall)
            {
                allowPrevent = false;
            }

            if (!ZeusProcessManager.IsDormant)
            {
                var dialogResult = MessageBox.Show(this,
                                                   "There are templates currently being executed. Would you like to kill them?",
                                                   "Warning",
                                                   MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    ZeusProcessManager.KillAll();
                }
                else
                {
                    e.Cancel = true;
                    return;
                }
            }

            if (allowSave && !Shutdown(allowPrevent))
            {
                e.Cancel = true;
            }
            else
            {
                SaveWindowState();
            }
        }