Example #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;

            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 = "_Start";
        }
Example #2
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;

            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;
        }
Example #3
0
 /// <summary>
 /// Create a ProfilingTargetView with values taken from a template.
 /// </summary>
 public ProfilingTargetView(IServiceProvider serviceProvider, ProfilingTarget template)
     : this(serviceProvider) {
     if (template.ProjectTarget != null) {
         Project = new ProjectTargetView(template.ProjectTarget);
         IsStandaloneSelected = false;
         IsProjectSelected = true;
     } else if (template.StandaloneTarget != null) {
         Standalone = new StandaloneTargetView(serviceProvider, template.StandaloneTarget);
         IsProjectSelected = false;
         IsStandaloneSelected = true;
     }
     _startText = "_OK";
 }