Ejemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 public bool require(string path)
 {
     try
     {
         _engine.Exec(path);
     }
     catch
     {
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            _applicationObject = (DTE2)application;
            _addInInstance = (AddIn)addInInst;

            if (connectMode == ext_ConnectMode.ext_cm_UISetup)
            {
                try
                {
                    _engine = new ScriptEngine();
                    Emmet4VsAddin.Context context = new Emmet4VsAddin.Context(_applicationObject, _addInInstance, _engine);
                    Emmet4VsAddin.Console console = new Emmet4VsAddin.Console(_applicationObject, _addInInstance, _engine);
                    _engine.Bind("context", context);
                    _engine.Bind("console", console);
                    _engine.Exec(context.Root + "\\startup.js");
                }
                catch
                {
                    return;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            _applicationObject = (DTE2)application;
            _addInInstance     = (AddIn)addInInst;

            if (connectMode == ext_ConnectMode.ext_cm_UISetup)
            {
                try
                {
                    _engine = new ScriptEngine();
                    Emmet4VsAddin.Context context = new Emmet4VsAddin.Context(_applicationObject, _addInInstance, _engine);
                    Emmet4VsAddin.Console console = new Emmet4VsAddin.Console(_applicationObject, _addInInstance, _engine);
                    _engine.Bind("context", context);
                    _engine.Bind("console", console);
                    _engine.Exec(context.Root + "\\startup.js");
                }
                catch
                {
                    return;
                }
            }
        }