Exemplo n.º 1
0
        /// <summary>
        /// Create a ProfilingTargetView with default values.
        /// </summary>
        public ProfilingTargetView(IServiceProvider serviceProvider)
        {
            var solution = serviceProvider.GetService(typeof(SVsSolution)) as IVsSolution;

            var availableProjects = new List <ProjectTargetView>();

            foreach (var project in solution.EnumerateLoadedProjects())
            {
                availableProjects.Add(new ProjectTargetView((IVsHierarchy)project));
            }
            _availableProjects = new ReadOnlyCollection <ProjectTargetView>(availableProjects);

            _project           = null;
            _standalone        = new StandaloneTargetView(serviceProvider);
            _isProjectSelected = true;

            _isValid = false;

            _useVTune = false;
#if EXTERNAL_PROFILER_DRIVER
            _isVTuneAvailable          = PythonProfilingPackage.CheckForExternalProfiler();
            _isExternalProfilerEnabled = true;
#else
            _isVTuneAvailable          = false;
            _isExternalProfilerEnabled = false;
#endif

            PropertyChanged             += new PropertyChangedEventHandler(ProfilingTargetView_PropertyChanged);
            _standalone.PropertyChanged += new PropertyChangedEventHandler(Standalone_PropertyChanged);

            var startupProject = PythonProfilingPackage.GetStartupProjectGuid(serviceProvider);
            Project = AvailableProjects.FirstOrDefault(p => p.Guid == startupProject) ??
                      AvailableProjects.FirstOrDefault();
            if (Project != null)
            {
                IsStandaloneSelected = false;
                IsProjectSelected    = true;
            }
            else
            {
                IsProjectSelected    = false;
                IsStandaloneSelected = true;
            }
            _startText = Strings.LaunchProfiling_Start;
        }
        public ProfilingSessionEditorFactory(PythonProfilingPackage package)
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering {0} constructor", this.ToString()));

            _editorPackage = package;
        }