コード例 #1
0
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // We do delayed initialization because DTE is currently null...
            PackageGlobals.BeginInvokeOnUIThread(DelayedInit);
        }
コード例 #2
0
        public virtual void Execute()
        {
            Debug.Assert(m_Error == null && m_Expression == null);
            try
            {
                if (m_Cache != null)
                {
                    CompiledExpression compiled_expression = m_Cache.GetEntry(m_Parser.Text);
                    m_Expression   = compiled_expression.expression;
                    m_Error        = compiled_expression.compile_error;
                    m_ContainsExec = compiled_expression.contains_exec;
                }
                else
                {
                    m_Expression   = m_Parser.Parse();
                    m_ContainsExec = m_Parser.ContainsExec;
                }

                if (m_Expression != null && m_EvalContext != null)
                {
                    m_EvalResult = m_Expression.Evaluate(new SafeEvalContext(m_EvalContext));
                    if (m_CollectUnresolvedVariables)
                    {
                        m_SortedUnresolvedVariables = m_Expression.CollectUnresolvedVariables(m_EvalContext);
                        m_SortedUnresolvedVariables.Sort(new VariablePosComparer());
                    }
                }
            }
            catch (Exception ex)
            {
                m_Error = ex;
            }

            PackageGlobals.BeginInvokeOnUIThread(delegate()
            {
                if (OnCompileFinished != null)
                {
                    OnCompileFinished(this);
                }
            });
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 void Schedule_UpdateWindowTitle()
 {
     PackageGlobals.BeginInvokeOnUIThread(UpdateWindowTitle);
 }