protected override void Dispose(bool disposing) { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Dispose() of: {0}", this.ToString())); Debug.Assert(disposing); if (m_ExpressionCompilerThread != null) { m_ExpressionCompilerThread.Dispose(); m_ExpressionCompilerThread = null; } PackageGlobals.DeinitInstance(); if (m_UpdateTimer != null) { m_UpdateTimer.Stop(); } IVsSolution vs_solution = (IVsSolution)GetService(typeof(IVsSolution)); if (vs_solution != null) { vs_solution.UnadviseSolutionEvents(m_SolutionEventsCookie); } IVsDebugger debugger = (IVsDebugger)GetService(typeof(IVsDebugger)); if (debugger != null) { debugger.UnadviseDebuggerEvents(m_DebuggerEventsCookie); } if (m_VSMainWindow != null) { m_VSMainWindow.Deinitialize(); m_VSMainWindow = null; } base.Dispose(disposing); }
private void DelayedInit() { DTE dte = (DTE)GetService(typeof(DTE)); if (dte == null) { // Usually this branch never executes but I want to make sure... PackageGlobals.BeginInvokeOnUIThread(DelayedInit); return; } m_VSMainWindow = new VSMainWindow(); m_VSMainWindow.Initialize((IntPtr)dte.MainWindow.HWnd); m_VSMainWindow.OnWindowTitleUpdateNeeded += m_VSMainWindow_OnWindowTitleUpdateNeeded; m_UpdateTimer = new System.Windows.Forms.Timer(); m_UpdateTimer.Tick += UpdateTimer_Tick; m_UpdateTimer.Interval = UPDATE_PERIOD_MILLISECS; m_UpdateTimer.Start(); IVsSolution vs_solution = (IVsSolution)GetService(typeof(IVsSolution)); vs_solution.AdviseSolutionEvents(this, out m_SolutionEventsCookie); IVsDebugger debugger = (IVsDebugger)GetService(typeof(IVsDebugger)); debugger.AdviseDebuggerEvents(this, out m_DebuggerEventsCookie); PackageGlobals.InitInstance(this); m_PrevVariableValues = PackageGlobals.Instance().CreateFreshEvalContext().VariableValues; m_ExpressionCompilerThread = new ExpressionCompilerThread(); // During normal use the expression doesn't change except when configuring so a cache size of 1 does the job quite well. // Usually what changes is the variables. m_CompiledExpressionCache = new CompiledExpressionCache(PackageGlobals.Instance().ExecFuncEvaluator, PackageGlobals.Instance().CompileTimeConstants, 1); UpdateWindowTitle(); }
protected override void Dispose(bool disposing) { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Dispose() of: {0}", this.ToString())); Debug.Assert(disposing); if (m_ExpressionCompilerThread != null) { m_ExpressionCompilerThread.Dispose(); m_ExpressionCompilerThread = null; } PackageGlobals.DeinitInstance(); if (m_UpdateTimer != null) m_UpdateTimer.Stop(); IVsSolution vs_solution = (IVsSolution)GetService(typeof(IVsSolution)); if (vs_solution != null) vs_solution.UnadviseSolutionEvents(m_SolutionEventsCookie); IVsDebugger debugger = (IVsDebugger)GetService(typeof(IVsDebugger)); if (debugger != null) debugger.UnadviseDebuggerEvents(m_DebuggerEventsCookie); if (m_VSMainWindow != null) { m_VSMainWindow.Deinitialize(); m_VSMainWindow = null; } base.Dispose(disposing); }
private void DelayedInit() { DTE dte = (DTE)GetService(typeof(DTE)); if (dte == null) { // Usually this branch never executes but I want to make sure... PackageGlobals.BeginInvokeOnUIThread(DelayedInit); return; } m_VSMainWindow = new VSMainWindow(); m_VSMainWindow.Initialize((IntPtr)dte.MainWindow.HWnd); m_VSMainWindow.OnWindowTitleUpdateNeeded += m_VSMainWindow_OnWindowTitleUpdateNeeded; m_UpdateTimer = new System.Windows.Forms.Timer(); m_UpdateTimer.Tick += UpdateTimer_Tick; m_UpdateTimer.Interval = UPDATE_PERIOD_MILLISECS; m_UpdateTimer.Start(); IVsSolution vs_solution = (IVsSolution)GetService(typeof(IVsSolution)); vs_solution.AdviseSolutionEvents(this, out m_SolutionEventsCookie); IVsDebugger debugger = (IVsDebugger)GetService(typeof(IVsDebugger)); debugger.AdviseDebuggerEvents(this, out m_DebuggerEventsCookie); PackageGlobals.InitInstance(this); m_PrevVariableValues = PackageGlobals.Instance().CreateFreshEvalContext().VariableValues; m_ExpressionCompilerThread = new ExpressionCompilerThread(); // During normal use the expression doesn't change except when configuring so a cache size of 1 does the job quite well. // Usually what changes is the variables. m_CompiledExpressionCache = new CompiledExpressionCache(PackageGlobals.Instance().ExecFuncEvaluator, PackageGlobals.Instance().CompileTimeConstants, 1); UpdateWindowTitle(); }