Exemplo n.º 1
0
 private void SetupScriptingScope()
 {
     if (hgScriptingHost != null)
     {
         this.Reset();
         hgScriptingHost = null;
     }
     hgScriptingHost = new ScriptingHost();
     hgScriptingHost.SetHost(homegenie, this.Address);
     if (scriptEngine.GetType() == typeof(ScriptEngine))
     {
         // IronPyton and IronRuby engines
         var     ironEngine = (scriptEngine as ScriptEngine);
         dynamic scope      = scriptScope = ironEngine.CreateScope();
         scope.hg = hgScriptingHost;
     }
     else if (scriptEngine.GetType() == typeof(Jint.Engine))
     {
         // Jint Javascript engine
         var javascriptEngine = (scriptEngine as Jint.Engine);
         javascriptEngine.SetValue("hg", hgScriptingHost);
     }
     else if (scriptEngine.GetType() == typeof(WizardEngine))
     {
         var wizardEngine = (scriptEngine as WizardEngine);
         wizardEngine.SetScriptingHost(hgScriptingHost);
     }
 }
Exemplo n.º 2
0
        public bool Load()
        {
            Unload();

            if (Homegenie == null)
            {
                return(false);
            }

            scriptEngine = new Engine();

            hgScriptingHost = new ScriptingHost();
            hgScriptingHost.SetHost(Homegenie, ProgramBlock.Address);
            scriptEngine.SetValue("hg", hgScriptingHost);
            return(true);
        }
Exemplo n.º 3
0
        public bool Load()
        {
            if (homegenie == null)
            {
                return(false);
            }

            if (hgScriptingHost != null)
            {
                this.Reset();
                hgScriptingHost = null;
            }
            hgScriptingHost = new ScriptingHost();
            hgScriptingHost.SetHost(homegenie, programBlock.Address);

            return(true);
        }
Exemplo n.º 4
0
 private void SetupScriptingScope()
 {
     hgScriptingHost = new ScriptingHost();
     hgScriptingHost.SetHost(homegenie, this.Address);
     if (scriptEngine.GetType() == typeof(ScriptEngine))
     {
         // IronPyton and IronRuby engines
         ScriptEngine currentEngine = (scriptEngine as ScriptEngine);
         dynamic      scope         = scriptScope = currentEngine.CreateScope();
         scope.hg = hgScriptingHost;
     }
     else if (scriptEngine.GetType() == typeof(Jint.Engine))
     {
         // Jint Javascript engine
         Jint.Engine javascriptEngine = (scriptEngine as Jint.Engine);
         javascriptEngine.SetValue("hg", hgScriptingHost);
     }
 }
Exemplo n.º 5
0
        public bool Load()
        {
            Unload();

            if (homegenie == null)
            {
                return(false);
            }

            scriptEngine = Ruby.CreateEngine();

            hgScriptingHost = new ScriptingHost();
            hgScriptingHost.SetHost(homegenie, programBlock.Address);
            dynamic scope = scriptScope = scriptEngine.CreateScope();

            scope.hg = hgScriptingHost;

            return(true);
        }
Exemplo n.º 6
0
        public bool Load()
        {
            if (HomeGenie == null)
            {
                return(false);
            }

            script = new WizardScript(ProgramBlock);

            if (hgScriptingHost != null)
            {
                this.Reset();
                hgScriptingHost = null;
            }
            hgScriptingHost = new ScriptingHost();
            hgScriptingHost.SetHost(HomeGenie, ProgramBlock.Address);

            return(true);
        }