示例#1
0
        public void SaveTitleSetupToOptions(TitleSetup title_setup)
        {
            ToolOptions options = (ToolOptions)GetDialogPage(typeof(ToolOptions));

            options.TitleSetup = title_setup;
            options.SaveSettingsToStorage();
        }
示例#2
0
        public bool IsDebugEnabled()
        {
            ToolOptions options = (ToolOptions)GetDialogPage(typeof(ToolOptions));

            return(options.Debug);
        }
示例#3
0
        public TitleSetup GetTitleSetupFromOptions()
        {
            ToolOptions options = (ToolOptions)GetDialogPage(typeof(ToolOptions));

            return(options.TitleSetup);
        }
示例#4
0
        private void UpdateWindowTitle()
        {
            m_VSMainWindow.Update();

            PackageGlobals globals           = PackageGlobals.Instance();
            EvalContext    eval_ctx          = globals.CreateFreshEvalContext();
            bool           variables_changed = !CompareVariables(eval_ctx.VariableValues, m_PrevVariableValues);

            if (variables_changed)
            {
                m_PrevVariableValues = eval_ctx.VariableValues;
                globals.TitleSetupEditor.Variables = eval_ctx.VariableValues;
            }

            ToolOptions options = (ToolOptions)GetDialogPage(typeof(ToolOptions));

#if VS2010_AND_LATER
            if (m_DebugPrintTitleControlHierarchyCount < 5 && options.Debug)
            {
                ++m_DebugPrintTitleControlHierarchyCount;
                m_VSMainWindow.DebugPrintTitleControlHierarchy();
            }
#endif

            PackageGlobals.VSMultiInstanceInfo multi_instance_info;
            globals.GetVSMultiInstanceInfo(out multi_instance_info);

            bool extension_active;
            switch (options.ExtensionActivationRule)
            {
            case EExtensionActivationRule.ActiveWithMultipleVSInstances:
                extension_active = multi_instance_info.multiple_instances;
                break;

            case EExtensionActivationRule.ActiveWithMultipleVSInstancesOfTheSameVersion:
                extension_active = multi_instance_info.multiple_instances_same_version;
                break;

            case EExtensionActivationRule.AlwaysInactive:
                extension_active = false;
                break;

            default:
                extension_active = true;
                break;
            }

            if (extension_active)
            {
                TitleSetup title_setup = globals.TitleSetup;
                if (m_ExpressionContainsExec || variables_changed || m_PrevExtensionActivationRule != options.ExtensionActivationRule ||
                    title_setup.TitleExpression != m_PrevTitleExpressionStr)
                {
                    Parser parser             = new Parser(title_setup.TitleExpression, globals.ExecFuncEvaluator, globals.CompileTimeConstants);;
                    ExpressionCompilerJob job = new ExpressionCompilerJob(parser, globals.CreateFreshEvalContext(), false, m_CompiledExpressionCache);
                    job.OnCompileFinished += OnCompileFinished;
                    m_ExpressionCompilerThread.RemoveAllJobs();
                    m_ExpressionCompilerThread.AddJob(job);
                }
                m_PrevTitleExpressionStr = title_setup.TitleExpression;
            }
            else
            {
                m_VSMainWindow.SetTitle(m_VSMainWindow.OriginalTitle);
            }

            m_PrevExtensionActivationRule = options.ExtensionActivationRule;
        }