public RubberduckIoCInstaller(IVBE vbe, IAddIn addin, GeneralSettings initialSettings, IVbeNativeApi vbeNativeApi)
 {
     _vbe             = vbe;
     _addin           = addin;
     _initialSettings = initialSettings;
     _vbeNativeApi    = vbeNativeApi;
 }
 public BeepInterceptor(IVbeNativeApi vbeApi)
 {
     _vbeApi         = vbeApi;
     _hook           = HookVbaBeep();
     _timer          = new Timer();
     _timer.Elapsed += TimerElapsed;
 }
示例#3
0
        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            try
            {
                _vbe          = RootComWrapperFactory.GetVbeWrapper(Application);
                _addin        = RootComWrapperFactory.GetAddInWrapper(AddInInst);
                _addin.Object = this;

                _vbeNativeApi    = new VbeNativeApiAccessor();
                _beepInterceptor = new BeepInterceptor(_vbeNativeApi);
                VbeProvider.Initialize(_vbe, _vbeNativeApi, _beepInterceptor);
                VbeNativeServices.HookEvents(_vbe);

                SetAddInObject();

                switch (ConnectMode)
                {
                case ext_ConnectMode.ext_cm_Startup:
                    // normal execution path - don't initialize just yet, wait for OnStartupComplete to be called by the host.
                    break;

                case ext_ConnectMode.ext_cm_AfterStartup:
                    _isBeginShutdownExecuted = false;       //When we reconnect after having been unloaded, the variable might no longer have its initial value.
                    InitializeAddIn();
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#4
0
        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            try
            {
                _vbe          = RootComWrapperFactory.GetVbeWrapper(Application);
                _addin        = RootComWrapperFactory.GetAddInWrapper(AddInInst);
                _addin.Object = this;

                VbeProvider.Initialize(_vbe);
                VbeNativeServices.HookEvents(_vbe);

                _vbeNativeApi = VbeProvider.VbeRuntime;
#if DEBUG
                // FOR DEBUGGING/DEVELOPMENT PURPOSES, ALLOW ACCESS TO SOME VBETypeLibsAPI FEATURES FROM VBA
                _addin.Object = new VBEditor.ComManagement.TypeLibsAPI.VBETypeLibsAPI_Object(_vbe);
#endif

                switch (ConnectMode)
                {
                case ext_ConnectMode.ext_cm_Startup:
                    // normal execution path - don't initialize just yet, wait for OnStartupComplete to be called by the host.
                    break;

                case ext_ConnectMode.ext_cm_AfterStartup:
                    _isBeginShutdownExecuted = false;       //When we reconnect after having been unloaded, the variable might no longer have its initial value.
                    InitializeAddIn();
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#5
0
 public VbeNativeApiAccessor(IVBE vbe)
 {
     if (_version == DllVersion.Unknown)
     {
         try
         {
             _version = VbeDllVersion.GetCurrentVersion(vbe);
         }
         catch
         {
             _version = DllVersion.Unknown;
         }
     }
     _runtime = InitializeRuntime();
 }
示例#6
0
 internal static void Initialize(IVBE vbe, IVbeNativeApi vbeNativeApi, IBeepInterceptor beepInterceptor)
 {
     Vbe             = vbe;
     VbeNativeApi    = vbeNativeApi;
     BeepInterceptor = beepInterceptor;
 }
 public ComMessagePumper(IUiContextProvider uiContext, IVbeNativeApi runtime)
 {
     _uiContext = uiContext;
     _runtime   = runtime;
 }