protected virtual void OnShowGUI(IZeusGuiControl gui) 
		{
			if (ShowGUI != null) 
			{
				ShowGUI(gui, this);
			}
		}
 protected virtual void OnShowGUI(IZeusGuiControl gui)
 {
     if (ShowGUI != null)
     {
         ShowGUI(gui, this);
     }
 }
示例#3
0
        public void ExecuteTemplate(ZeusTemplate template)
        {
            Cursor.Current = Cursors.WaitCursor;

            DefaultSettings settings = DefaultSettings.Instance;

            IZeusContext    context       = new ZeusContext();
            IZeusGuiControl guiController = context.Gui;
            IZeusOutput     zout          = context.Output;

            settings.PopulateZeusContext(context);

            bool exceptionOccurred = false;
            bool result            = false;

            try
            {
                template.GuiSegment.ZeusScriptingEngine.ExecutionHelper.Timeout = settings.ScriptTimeout;
                template.GuiSegment.ZeusScriptingEngine.ExecutionHelper.SetShowGuiHandler(new ShowGUIEventHandler(DynamicGUI_Display));
                result = template.GuiSegment.Execute(context);
                template.GuiSegment.ZeusScriptingEngine.ExecutionHelper.Cleanup();

                if (result)
                {
                    template.BodySegment.ZeusScriptingEngine.ExecutionHelper.Timeout = settings.ScriptTimeout;
                    result = template.BodySegment.Execute(context);
                    template.BodySegment.ZeusScriptingEngine.ExecutionHelper.Cleanup();
                }
            }
            catch (Exception ex)
            {
                mdi.ErrorsOccurred(ex);
                //ZeusDisplayError formError = new ZeusDisplayError(ex);
                //formError.SetControlsFromException();
                //formError.ShowDialog(this);

                exceptionOccurred = true;
            }

            Cursor.Current = Cursors.Default;

            if (!exceptionOccurred && result)
            {
                if (settings.EnableClipboard)
                {
                    try
                    {
                        Clipboard.SetDataObject(zout.text, true);
                    }
                    catch
                    {
                        // HACK: For some reason, Clipboard.SetDataObject throws an error on some systems. I'm cathhing it and doing nothing for now.
                    }
                }

                MessageBox.Show("Successfully rendered Template: " + template.Title);
            }
        }
示例#4
0
        public void DynamicGUI_Display(IZeusGuiControl gui, IZeusFunctionExecutioner executioner)
        {
            try
            {
                DynamicForm  df     = new DynamicForm(gui as GuiController, executioner);
                DialogResult result = df.ShowDialog();

                if (result == DialogResult.Cancel)
                {
                    gui.IsCanceled = true;
                }
            }
            catch (Exception ex)
            {
                _log.Write(ex);
            }
        }
        public void DynamicGUI_Display(IZeusGuiControl gui, IZeusFunctionExecutioner executioner)
        {
            this.Cursor = Cursors.Default;

            try
            {
                DynamicForm  df     = new DynamicForm(gui as GuiController, executioner);
                DialogResult result = df.ShowDialog(this);

                if (result == DialogResult.Cancel)
                {
                    gui.IsCanceled = true;
                }
            }
            catch (Exception ex)
            {
                OnErrorsOccurred(ex);
            }

            Cursor.Current = Cursors.Default;
        }
		public void DynamicGUI_Display(IZeusGuiControl gui, IZeusFunctionExecutioner executioner) 
		{
			this.Cursor = Cursors.Default;

			try 
			{
				DynamicForm df = new DynamicForm(gui as GuiController, executioner);
				DialogResult result = df.ShowDialog(this);
				
				if(result == DialogResult.Cancel) 
				{
					gui.IsCanceled = true;
				}
			}
			catch (Exception ex)
			{
				ZeusDisplayError formError = new ZeusDisplayError(ex);
				formError.SetControlsFromException();			
				formError.ShowDialog(this);
			}

			Cursor.Current = Cursors.Default;
		}
        public void ExecuteTemplate(ZeusTemplate template)
        {
            bool overridden = false;

            if (ExecuteTemplateOverride != null)
            {
                overridden = ExecuteTemplateOverride(TemplateOperations.Execute, template, null, _guiHandler);
            }

            if (!overridden)
            {
                Cursor.Current = Cursors.WaitCursor;

                DefaultSettings settings = DefaultSettings.Instance;

                IZeusContext    context       = new ZeusContext();
                IZeusGuiControl guiController = context.Gui;
                IZeusOutput     zout          = context.Output;

                settings.PopulateZeusContext(context);

                bool exceptionOccurred = false;
                bool result            = false;

                try
                {
                    template.GuiSegment.ZeusScriptingEngine.ExecutionHelper.Timeout = settings.ScriptTimeout;
                    template.GuiSegment.ZeusScriptingEngine.ExecutionHelper.SetShowGuiHandler(_guiHandler);
                    result = template.GuiSegment.Execute(context);
                    template.GuiSegment.ZeusScriptingEngine.ExecutionHelper.Cleanup();

                    if (result)
                    {
                        template.BodySegment.ZeusScriptingEngine.ExecutionHelper.Timeout = settings.ScriptTimeout;
                        result = template.BodySegment.Execute(context);

                        foreach (string filePath in context.Output.SavedFiles)
                        {
                            this.OnGeneratedFileSaved(filePath);
                        }

                        template.BodySegment.ZeusScriptingEngine.ExecutionHelper.Cleanup();
                    }
                }
                catch (Exception ex)
                {
                    OnErrorsOccurred(ex);

                    exceptionOccurred = true;
                }

                Cursor.Current = Cursors.Default;

                if (!exceptionOccurred && result)
                {
                    if (settings.EnableClipboard)
                    {
                        try
                        {
                            Clipboard.SetDataObject(zout.text, true);
                        }
                        catch
                        {
                            // HACK: For some reason, Clipboard.SetDataObject throws an error on some systems. I'm cathhing it and doing nothing for now.
                        }
                    }

                    MessageBox.Show("Successfully rendered Template: " + template.Title);
                }
            }
        }
        public void DynamicGUI_Display(IZeusGuiControl gui, IZeusFunctionExecutioner executioner)
        {
            this.Cursor = Cursors.Default;

            try
            {
                DynamicForm df = new DynamicForm(gui as GuiController, executioner);
                df.Logger = this;
                DialogResult result = df.ShowDialog(this);

                if (result == DialogResult.Cancel)
                {
                    gui.IsCanceled = true;
                }
            }
            catch (Exception x)
            {
                HandleExecuteException(x);
            }

            this.Cursor = Cursors.WaitCursor;
        }
		public void DynamicGUI_Display(IZeusGuiControl gui, IZeusFunctionExecutioner executioner) 
		{
			try 
			{
				DynamicForm df = new DynamicForm(gui as GuiController, executioner);
				DialogResult result = df.ShowDialog();
			
				if(result == DialogResult.Cancel) 
				{
					gui.IsCanceled = true;
				}
			}
			catch (Exception ex)
			{
				_log.Write(ex);
			}
		}