Ejemplo n.º 1
0
 /// <summary>
 /// Occurs when global items are needed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 static  void OnGlobalItemsNeeded(object sender, VsaScriptingHostEventArgs e)
 {
     // publish the scriptable form so that the scripts may modify it
     e.Host.CreateGlobalItem("_scriptableForm", typeof(Evaluator), false);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds this instance of the VsaScriptingHost class as a global item named "VsaScriptingHost" and raises the GlobalItemsNeeded
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void OnGlobalItemsNeeded(object sender, VsaScriptingHostEventArgs e)
        {
            try
            {
                // add the scripting host as a global item so that all scripts will have access to the VsaScriptingHost instance
                this.CreateGlobalItem(@"_scriptingHost", this, false);

                // raise the event
                if (this.GlobalItemsNeeded != null)
                    this.GlobalItemsNeeded(sender, e);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Occurs when assembly references are needed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 static void OnAssemblyReferencesNeeded(object sender, VsaScriptingHostEventArgs e)
 {
     // add the current assembly as a reference
     e.Host.CreateAssemblyReferences(Assembly.GetExecutingAssembly().Location);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds our default assembly references and raises the AssemblyReferencesNeeded event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void OnAssemblyReferencesNeeded(object sender, VsaScriptingHostEventArgs e)
        {
            try
            {
                /*
                 * NOTE: By default the assemblies reference by this dll are added.
                 * 
                 * create the default assembly references from the scripting host itself
                 * this will cover most of the references that are commonly needed
                 * if other assemblies are needed, responding to this event will provide the 
                 * opportunity to add them
                 * 
                 * */
                this.CreateAssemblyReferences(VsaScriptingHost.DefaultAssemblyReferences);

                // always reference the current scripting host assembly
                this.CreateAssemblyReferences(Assembly.GetExecutingAssembly().Location);

                // raise the event 
                if (this.AssemblyReferencesNeeded != null)
                    this.AssemblyReferencesNeeded(sender, e);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
        }