Beispiel #1
0
        /// <summary>
        /// sets the scriptingHost from which textBoxes should take their content
        /// </summary>
        /// <param name="sh">scriptingHost to set</param>
        public void SetScriptingHost(IScriptingHost sh)
        {
            if (sh == null)
            {
                return;
            }
            scriptingHost = sh;

            foreach (string reference in scriptingHost.References)
            {
                textReferences.Text += reference + Environment.NewLine;
            }
            // strange AppendText bug!!!

            foreach (string ns in scriptingHost.Namespaces)
            {
                textNamespaces.Text += ns + Environment.NewLine;
            }

            textTemplate.Text = scriptingHost.TemplateSource;
        }
Beispiel #2
0
        //-------------------------------------------------------------------------
        #endregion
        //-------------------------------------------------------------------------

        //-------------------------------------------------------------------------
        #region Methods
        //-------------------------------------------------------------------------
        /// <summary>
        /// compile the source (property Source)
        /// </summary>
        public void Compile()
        {
            script             = null;
            lastCompiledSource = source;
            IScriptingHost host = GetHost();

            host.Source = source;

            host.References.Clear();
            foreach (string refer in references)
            {
                host.References.Add(refer);
            }

            host.Namespaces.Clear();
            foreach (string ns in namespaces)
            {
                host.Namespaces.Add(ns);
            }

            script = host.Create();
        }
Beispiel #3
0
 /// <summary>
 /// constructor filling textboxes with info from ScriptingHost
 /// </summary>
 /// <param name="sh">ScriptingHost to take info from</param>
 public ScriptingHostTemplateForm(IScriptingHost sh) : this()
 {
     SetScriptingHost(sh);
 }