/// <summary>
        /// Create a ProfilingTargetView with default values.
        /// </summary>
        public ProfilingTargetView() {
            var solution = NodejsProfilingPackage.Instance.Solution;
            
            var availableProjects = new List<ProjectTargetView>();
            foreach (var project in solution.EnumerateLoadedProjects(onlyNodeProjects: true)) {
                availableProjects.Add(new ProjectTargetView((IVsHierarchy)project));
            }
            _availableProjects = new ReadOnlyCollection<ProjectTargetView>(availableProjects);

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

            _isValid = false;

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

            var startupProject = NodejsProfilingPackage.Instance.GetStartupProjectGuid();
            Project = AvailableProjects.FirstOrDefault(p => p.Guid == startupProject) ??
                AvailableProjects.FirstOrDefault();
            if (Project != null) {
                IsStandaloneSelected = false;
                IsProjectSelected = true;
            } else {
                IsProjectSelected = false;
                IsStandaloneSelected = true;
            }
            _startText = Resources.ProfilingStart;
        }
 /// <summary>
 /// Create a ProfilingTargetView with values taken from a template.
 /// </summary>
 /// <param name="template"></param>
 public ProfilingTargetView(ProfilingTarget template)
     : this() {
     if (template.ProjectTarget != null) {
         Project = new ProjectTargetView(template.ProjectTarget);
         IsStandaloneSelected = false;
         IsProjectSelected = true;
     } else if (template.StandaloneTarget != null) {
         Standalone = new StandaloneTargetView(template.StandaloneTarget);
         IsProjectSelected = false;
         IsStandaloneSelected = true;
     }
     _startText = Resources.ProfilingOk;
 }
Beispiel #3
0
        /// <summary>
        /// Create a ProfilingTargetView with default values.
        /// </summary>
        public ProfilingTargetView()
        {
            var solution = NodejsProfilingPackage.Instance.Solution;

            var availableProjects = new List <ProjectTargetView>();

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

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

            _isValid = false;

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

            var startupProject = NodejsProfilingPackage.Instance.GetStartupProjectGuid();

            Project = AvailableProjects.FirstOrDefault(p => p.Guid == startupProject) ??
                      AvailableProjects.FirstOrDefault();
            if (Project != null)
            {
                IsStandaloneSelected = false;
                IsProjectSelected    = true;
            }
            else
            {
                IsProjectSelected    = false;
                IsStandaloneSelected = true;
            }
            _startText = Resources.ProfilingStart;
        }