override protected void EngineExecuteCode(ZeusCodeSegment segment, ZeusTemplateContext context)
		{
			try 
			{
				this.Cleanup();
				this._codeSegment = segment;
			
				this._currentObject = InstantiateClass( this.CurrentAssembly, typeof(_DotNetScriptTemplate), context );

				if (this._currentObject is _DotNetScriptTemplate)
				{
					this._primaryObject = this._currentObject as _DotNetScriptTemplate;
					this._primaryObject.Render();
				}
			}
			catch (ZeusCompilerException ex)
			{
				ex.IsTemplateScript = true;
				throw ex;
			}
		}
Ejemplo n.º 2
0
        override protected void EngineExecuteCode(ZeusCodeSegment segment, ZeusTemplateContext context)
        {
            try
            {
                this.Cleanup();
                this._codeSegment = segment;

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

                if (this._currentObject is _DotNetScriptTemplate)
                {
                    this._primaryObject = this._currentObject as _DotNetScriptTemplate;
                    this._primaryObject.Render();
                }
            }
            catch (ZeusCompilerException ex)
            {
                ex.IsTemplateScript = true;
                throw ex;
            }
        }
		public _DotNetScriptTemplate(ZeusTemplateContext context)
		{
			this.input = context.Input;
			this.objects = context.Objects;
			this.output = context.Output;
		}
Ejemplo n.º 4
0
 public _DotNetScriptTemplate(ZeusTemplateContext context)
 {
     this.input   = context.Input;
     this.objects = context.Objects;
     this.output  = context.Output;
 }
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;
        }