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 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; }