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;
 }
		public bool Collect(ZeusTemplate template, IZeusContext context, int timeout, InputItemCollection collectedinput, ShowGUIEventHandler eventhandler) 
		{
			IZeusExecutionHelper execHelper = null;
			bool exceptionOccurred = false;
			bool result = false;
			try 
			{
				//Initialize Context for collection 
				collectedinput.CopyTo(context.Gui.Defaults);
				context.Gui.ForceDisplay = true;
				collectedinput.Clear();

				execHelper = template.GuiSegment.ZeusScriptingEngine.ExecutionHelper;
				execHelper.Timeout = timeout;

				if (eventhandler == null) 
				{
					execHelper.SetShowGuiHandler(new ShowGUIEventHandler(DynamicGUI_Display));
				}
				else 
				{
					execHelper.SetShowGuiHandler(new ShowGUIEventHandler(eventhandler));
				}

				result = template.GuiSegment.Execute(context); 
				execHelper.Cleanup();

				if (collectedinput != null)
				{
					collectedinput.Add(context.Input);
				}
			}
			catch (Exception ex)
			{
				context.Log.Write(ex);
				exceptionOccurred = true;
			}

			if (!exceptionOccurred && result)
			{
				context.Log.Write("Successfully collected input for Template: " + template.Title);
			}
			else 
			{
				context.Log.Write("Canceled Template execution: " + template.Title);
			}

			return result;
		}
 private bool templateBrowserControl1_ExecuteOverride(TemplateOperations operation, ZeusTemplate template, ZeusSavedInput input, ShowGUIEventHandler guiEventHandler)
 {
     switch (operation)
     {
         case TemplateOperations.Execute:
             ZeusProcessManager.ExecuteTemplate(template.FullFileName, processCallback);
             break;
         case TemplateOperations.ExecuteLoadedInput:
             ZeusProcessManager.ExecuteSavedInput(input.FilePath, processCallback);
             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)
             {
                 ZeusProcessManager.RecordTemplateInput(template.FullFileName, saveFileDialog.FileName, processCallback);
             }
             break;
     }
     return true;
 }
Example #4
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);
        }
 public TemplateBrowserControl()
 {
     InitializeComponent();
     this._guiHandler = new ShowGUIEventHandler(this.DynamicGUI_Display);
 }
        private bool templateBrowserControl1_ExecuteOverride(TemplateOperations operation, ZeusTemplate template, ZeusSavedInput input, ShowGUIEventHandler guiEventHandler)
        {
            switch (operation)
            {
            case TemplateOperations.Execute:
                ZeusProcessManager.ExecuteTemplate(template.FullFileName, processCallback);
                break;

            case TemplateOperations.ExecuteLoadedInput:
                ZeusProcessManager.ExecuteSavedInput(input.FilePath, processCallback);
                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)
                {
                    ZeusProcessManager.RecordTemplateInput(template.FullFileName, saveFileDialog.FileName, processCallback);
                }
                break;
            }
            return(true);
        }
		public void SetShowGuiHandler(ShowGUIEventHandler guiEventHandler)
		{
			this.ShowGUI = null;
			this.ShowGUI += guiEventHandler;
		}
        public TemplateBrowserControl()
        {
            InitializeComponent();
            this._guiHandler = new ShowGUIEventHandler(this.DynamicGUI_Display);

        }
 public void SetShowGuiHandler(ShowGUIEventHandler guiEventHandler)
 {
     this.ShowGUI  = null;
     this.ShowGUI += guiEventHandler;
 }
Example #10
0
        public IZeusContext Execute(ZeusTemplate template, IZeusContext context, int timeout, InputItemCollection collectedinput, ShowGUIEventHandler eventhandler, bool skipGui)
        {
            IZeusExecutionHelper execHelper = null;
            bool exceptionOccurred          = false;
            bool result = false;

            try
            {
                if (skipGui)
                {
                    PopulateContextObjects(context);
                    foreach (IZeusContextProcessor processor in ZeusFactory.Preprocessors)
                    {
                        processor.Process(context);
                    }
                    result = true;
                }
                else
                {
                    execHelper         = template.GuiSegment.ZeusScriptingEngine.ExecutionHelper;
                    execHelper.Timeout = timeout;

                    if (eventhandler == null)
                    {
                        execHelper.SetShowGuiHandler(new ShowGUIEventHandler(DynamicGUI_Display));
                    }
                    else
                    {
                        execHelper.SetShowGuiHandler(new ShowGUIEventHandler(eventhandler));
                    }

                    result = template.GuiSegment.Execute(context);
                    execHelper.Cleanup();

                    if (collectedinput != null)
                    {
                        collectedinput.Add(context.Input);
                    }
                }
                if (result)
                {
                    execHelper         = template.BodySegment.ZeusScriptingEngine.ExecutionHelper;
                    execHelper.Timeout = timeout;
                    result             = template.BodySegment.Execute(context);
                }
            }
            catch (Exception ex)
            {
                context.Log.Write(ex);
                exceptionOccurred = true;
            }

            if (!exceptionOccurred && result)
            {
                context.Log.Write("Successfully rendered Template: " + template.Title);
            }
            else
            {
                context.Log.Write("Canceled Template execution: " + template.Title);
            }

            return(context);
        }
Example #11
0
        public bool Collect(ZeusTemplate template, IZeusContext context, int timeout, InputItemCollection collectedinput, ShowGUIEventHandler eventhandler)
        {
            IZeusExecutionHelper execHelper = null;
            bool exceptionOccurred          = false;
            bool result = false;

            try
            {
                //Initialize Context for collection
                collectedinput.CopyTo(context.Gui.Defaults);
                context.Gui.ForceDisplay = true;
                collectedinput.Clear();

                execHelper         = template.GuiSegment.ZeusScriptingEngine.ExecutionHelper;
                execHelper.Timeout = timeout;

                if (eventhandler == null)
                {
                    execHelper.SetShowGuiHandler(new ShowGUIEventHandler(DynamicGUI_Display));
                }
                else
                {
                    execHelper.SetShowGuiHandler(new ShowGUIEventHandler(eventhandler));
                }

                result = template.GuiSegment.Execute(context);
                execHelper.Cleanup();

                if (collectedinput != null)
                {
                    collectedinput.Add(context.Input);
                }
            }
            catch (Exception ex)
            {
                context.Log.Write(ex);
                exceptionOccurred = true;
            }

            if (!exceptionOccurred && result)
            {
                context.Log.Write("Successfully collected input for Template: " + template.Title);
            }
            else
            {
                context.Log.Write("Canceled Template execution: " + template.Title);
            }

            return(result);
        }
		public IZeusContext Execute(ZeusTemplate template, IZeusContext context, int timeout, InputItemCollection collectedinput, ShowGUIEventHandler eventhandler, bool skipGui) 
		{
			IZeusExecutionHelper execHelper = null;
			bool exceptionOccurred = false;
			bool result = false;
			try 
			{
				if (skipGui)
				{
					PopulateContextObjects(context);
					foreach (IZeusContextProcessor processor in ZeusFactory.Preprocessors) 
					{
						processor.Process(context);
					}
					result = true;
				}
				else 
				{
					execHelper = template.GuiSegment.ZeusScriptingEngine.ExecutionHelper;
					execHelper.Timeout = timeout;

					if (eventhandler == null) 
					{
						execHelper.SetShowGuiHandler(new ShowGUIEventHandler(DynamicGUI_Display));
					}
					else 
					{
						execHelper.SetShowGuiHandler(new ShowGUIEventHandler(eventhandler));
					}

					result = template.GuiSegment.Execute(context); 
					execHelper.Cleanup();

					if (collectedinput != null)
					{
						collectedinput.Add(context.Input);
					}
				}
				if (result) 
				{
					execHelper = template.BodySegment.ZeusScriptingEngine.ExecutionHelper;
					execHelper.Timeout = timeout;
					result = template.BodySegment.Execute(context);
				}
			}
			catch (Exception ex)
			{
				context.Log.Write(ex);
				exceptionOccurred = true;
			}

			if (!exceptionOccurred && result)
			{
				context.Log.Write("Successfully rendered Template: " + template.Title);
			}
			else 
			{
				context.Log.Write("Canceled Template execution: " + template.Title);
			}

			return context;
		}