override protected void EngineExecuteGuiCode(ZeusCodeSegment segment, ZeusGuiContext context)
		{
			try 
			{
				this.Cleanup();
				this._codeSegment = segment;

				this._currentObject = InstantiateClass( this.CurrentAssembly, typeof(_DotNetScriptGui), context );

				if (this._currentObject is _DotNetScriptGui)
				{
					this._interfaceObject = this._currentObject as _DotNetScriptGui;
					this._interfaceObject.Setup();
				}
				
				if (context.Gui.ShowGui)
				{
					OnShowGUI(context.Gui);
					if (!context.Gui.IsCanceled) 
					{
						context.Input.AddItems(context.Gui);
					}
				}

			}
			catch (ZeusCompilerException ex)
			{
				ex.IsTemplateScript = false;
				throw ex;
			}
		}
Ejemplo n.º 2
0
        override protected void EngineExecuteGuiCode(ZeusCodeSegment segment, ZeusGuiContext context)
        {
            try
            {
                this.Cleanup();
                this._codeSegment = segment;

                this._currentObject = InstantiateClass(this.CurrentAssembly, typeof(_DotNetScriptGui), context);

                if (this._currentObject is _DotNetScriptGui)
                {
                    this._interfaceObject = this._currentObject as _DotNetScriptGui;
                    this._interfaceObject.Setup();
                }

                if (context.Gui.ShowGui)
                {
                    OnShowGUI(context.Gui);
                    if (!context.Gui.IsCanceled)
                    {
                        context.Input.AddItems(context.Gui);
                    }
                }
            }
            catch (ZeusCompilerException ex)
            {
                ex.IsTemplateScript = false;
                throw ex;
            }
        }
Ejemplo n.º 3
0
		public _DotNetScriptGui(ZeusGuiContext context)
		{
			this.input = context.Input;
			this.objects = context.Objects;
			this.ui = context.Gui;
		}
Ejemplo n.º 4
0
 public _DotNetScriptGui(ZeusGuiContext context)
 {
     this.input   = context.Input;
     this.objects = context.Objects;
     this.ui      = context.Gui;
 }
Ejemplo n.º 5
0
        public void ExecuteTemplate(ZeusTemplate template)
        {
            this.Cursor = Cursors.WaitCursor;

            DefaultSettings settings = new DefaultSettings();

            ZeusInput           zin     = new ZeusInput();
            ZeusOutput          zout    = new ZeusOutput();
            Hashtable           objects = new Hashtable();
            ZeusGuiContext      guicontext;
            ZeusTemplateContext bodycontext = null;

            dbRoot myMeta = new dbRoot();

            // Set the global variables for the default template/output paths
            zin["defaultTemplatePath"] = settings.DefaultTemplateDirectory;
            zin["defaultOutputPath"]   = settings.DefaultOutputDirectory;

            string driver, connectionString;

            //if there is a connection string set, it in the input section here.
            if (settings.DbDriver != string.Empty)
            {
                driver           = settings.DbDriver;
                connectionString = settings.ConnectionString;

                zin["dbDriver"]           = driver;
                zin["dbConnectionString"] = connectionString;

                try
                {
                    // Try to connect to the DB with MyMeta (using default connection info)
                    myMeta.Connect(settings.DbDriver, settings.ConnectionString);

                    // Set DB global variables and also input variables

                    if (settings.DbTarget != string.Empty)
                    {
                        myMeta.DbTarget = settings.DbTarget;
                    }

                    if (settings.DbTargetMappingFile != string.Empty)
                    {
                        myMeta.DbTargetMappingFileName = settings.DbTargetMappingFile;
                    }

                    if (settings.LanguageMappingFile != string.Empty)
                    {
                        myMeta.LanguageMappingFileName = settings.LanguageMappingFile;
                    }

                    if (settings.DbTarget != string.Empty)
                    {
                        myMeta.DbTarget = settings.DbTarget;
                    }

                    if (settings.Language != string.Empty)
                    {
                        myMeta.Language = settings.Language;
                    }

                    if (settings.UserMetaDataFileName != string.Empty)
                    {
                        myMeta.UserMetaDataFileName = settings.UserMetaDataFileName;
                    }
                }
                catch
                {
                    // Give them an empty MyMeta
                    myMeta = new dbRoot();
                }
            }

            bool exceptionOccurred = false;

            bool result = false;

            try
            {
                // Add any objects here that need to be embedded in the script.
                objects.Add("MyMeta", myMeta);

                guicontext = new ZeusGuiContext(zin, new GuiController(), objects);

                template.GuiSegment.ZeusScriptingEngine.Executioner.ScriptTimeout = settings.ScriptTimeout;
                template.GuiSegment.ZeusScriptingEngine.Executioner.SetShowGuiHandler(new ShowGUIEventHandler(DynamicGUI_Display));
                result = template.GuiSegment.Execute(guicontext);

                if (result)
                {
                    bodycontext = new ZeusTemplateContext(guicontext);
                    result      = template.BodySegment.Execute(bodycontext);
                }
            }
            catch (Exception ex)
            {
                ZeusDisplayError formError = new ZeusDisplayError(ex);
                formError.SetControlsFromException();
                formError.ShowDialog(this);

                exceptionOccurred = true;
            }

            if (!exceptionOccurred && result)
            {
                MessageBox.Show("Successfully rendered template: " + template.Title);
            }

            this.Cursor = Cursors.Default;
        }