Inheritance: IDisposable
Example #1
0
        public IntelliSenseDisplay(SynchronizationContext syncContextMain, UIMonitor uiMonitor)
        {
            // We expect this to be running in a macro context on the main Excel thread (ManagedThreadId = 1).
            #pragma warning disable CS0618 // Type or member is obsolete (GetCurrentThreadId) - But for debugging we want to monitor this anyway
            Debug.Print($"### Thread creating IntelliSenseDisplay: Managed {Thread.CurrentThread.ManagedThreadId}, Native {AppDomain.GetCurrentThreadId()}");
            #pragma warning restore CS0618 // Type or member is obsolete

            _syncContextMain = syncContextMain;
            _uiMonitor       = uiMonitor;
            _uiMonitor.StateUpdatePreview += StateUpdatePreview;
            _uiMonitor.StateUpdate        += StateUpdate;

            InitializeOptions();
        }
        public IntelliSenseDisplay(SynchronizationContext syncContextMain, UIMonitor uiMonitor)
        {
            // We expect this to be running in a macro context on the main Excel thread (ManagedThreadId = 1).
            #pragma warning disable CS0618 // Type or member is obsolete (GetCurrentThreadId) - But for debugging we want to monitor this anyway
            Debug.Print($"### Thread creating IntelliSenseDisplay: Managed {Thread.CurrentThread.ManagedThreadId}, Native {AppDomain.GetCurrentThreadId()}");
            #pragma warning restore CS0618 // Type or member is obsolete

            _syncContextMain = syncContextMain;
            _uiMonitor = uiMonitor;
            _uiMonitor.StateUpdatePreview += StateUpdatePreview;
            _uiMonitor.StateUpdate += StateUpdate;

            InitializeOptions();
        }
        // TODO: Others

        public IntelliSenseHelper()
        {
            Logger.Initialization.Verbose("IntelliSenseHelper Constructor Begin");
            _syncContextMain = new WindowsFormsSynchronizationContext();
            _uiMonitor       = new UIMonitor(_syncContextMain);
            _display         = new IntelliSenseDisplay(_syncContextMain, _uiMonitor);

            _providers = new List <IIntelliSenseProvider>
            {
                new ExcelDnaIntelliSenseProvider(_syncContextMain),
            };

            RegisterIntellisense();
            Logger.Initialization.Verbose("IntelliSenseHelper Constructor End");
        }
        readonly UIMonitor _uiMonitor; // We want the UIMonitor here, because we might hook up other display enhancements

        #endregion Fields

        #region Constructors

        // TODO: Others
        public IntelliSenseHelper()
        {
            Logger.Initialization.Verbose("IntelliSenseHelper Constructor Begin");
            _syncContextMain = new WindowsFormsSynchronizationContext();
            _uiMonitor = new UIMonitor(_syncContextMain);
            _display = new IntelliSenseDisplay(_syncContextMain, _uiMonitor);

            _providers = new List<IIntelliSenseProvider>
            {
                new ExcelDnaIntelliSenseProvider(_syncContextMain),
                new WorkbookIntelliSenseProvider(),
            };

            RegisterIntellisense();
            Logger.Initialization.Verbose("IntelliSenseHelper Constructor End");
        }