void IPropertyPage.SetObjects(uint cObjects, object[] ppunk) { if (cObjects == 0) { if (_project != null) { //_project.CurrentOutputTypeChanging -= new PropertyChangingEventHandler( HandleOutputTypeChanging ); _project = null; } return; } if (ppunk[0] is ProjectConfig) { List<ProjectConfig> configs = new List<ProjectConfig>(); for (int i = 0; i < cObjects; i++) { ProjectConfig config = (ProjectConfig)ppunk[i]; if (_project == null) { _project = config.ProjectManager as DartProjectNode; //_project.CurrentOutputTypeChanging += new PropertyChangingEventHandler( HandleOutputTypeChanging ); } configs.Add(config); } _projectConfigs = configs.ToArray(); } else if (ppunk[0] is NodeProperties) { if (_project == null) { _project = (ppunk[0] as NodeProperties).Node.ProjectManager as DartProjectNode; //_project.CurrentOutputTypeChanging += new PropertyChangingEventHandler( HandleOutputTypeChanging ); } Dictionary<string, ProjectConfig> configsMap = new Dictionary<string, ProjectConfig>(); for (int i = 0; i < cObjects; i++) { NodeProperties property = (NodeProperties)ppunk[i]; IVsCfgProvider provider; ErrorHandler.ThrowOnFailure(property.Node.ProjectManager.GetCfgProvider(out provider)); uint[] expected = new uint[1]; ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null)); if (expected[0] > 0) { ProjectConfig[] configs = new ProjectConfig[expected[0]]; uint[] actual = new uint[1]; int hr = provider.GetCfgs(expected[0], configs, actual, null); if (hr != VSConstants.S_OK) Marshal.ThrowExceptionForHR(hr); foreach (ProjectConfig config in configs) { string key = string.Format("{0}|{1}", config.ConfigName, config.Platform); if (!configsMap.ContainsKey(key)) configsMap.Add(key, config); } } } if (configsMap.Count > 0) { if (_projectConfigs == null) _projectConfigs = new ProjectConfig[configsMap.Keys.Count]; configsMap.Values.CopyTo(_projectConfigs, 0); } } if (_active && _project != null) { BindProperties(); IsDirty = false; } }
void IPropertyPage.SetObjects(uint cObjects, object[] ppunk) { if (cObjects == 0) { if (_project != null) { //_project.CurrentOutputTypeChanging -= new PropertyChangingEventHandler( HandleOutputTypeChanging ); _project = null; } return; } if (ppunk[0] is ProjectConfig) { List <ProjectConfig> configs = new List <ProjectConfig>(); for (int i = 0; i < cObjects; i++) { ProjectConfig config = (ProjectConfig)ppunk[i]; if (_project == null) { _project = config.ProjectManager as DartProjectNode; //_project.CurrentOutputTypeChanging += new PropertyChangingEventHandler( HandleOutputTypeChanging ); } configs.Add(config); } _projectConfigs = configs.ToArray(); } else if (ppunk[0] is NodeProperties) { if (_project == null) { _project = (ppunk[0] as NodeProperties).Node.ProjectManager as DartProjectNode; //_project.CurrentOutputTypeChanging += new PropertyChangingEventHandler( HandleOutputTypeChanging ); } Dictionary <string, ProjectConfig> configsMap = new Dictionary <string, ProjectConfig>(); for (int i = 0; i < cObjects; i++) { NodeProperties property = (NodeProperties)ppunk[i]; IVsCfgProvider provider; ErrorHandler.ThrowOnFailure(property.Node.ProjectManager.GetCfgProvider(out provider)); uint[] expected = new uint[1]; ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null)); if (expected[0] > 0) { ProjectConfig[] configs = new ProjectConfig[expected[0]]; uint[] actual = new uint[1]; int hr = provider.GetCfgs(expected[0], configs, actual, null); if (hr != VSConstants.S_OK) { Marshal.ThrowExceptionForHR(hr); } foreach (ProjectConfig config in configs) { string key = string.Format("{0}|{1}", config.ConfigName, config.Platform); if (!configsMap.ContainsKey(key)) { configsMap.Add(key, config); } } } } if (configsMap.Count > 0) { if (_projectConfigs == null) { _projectConfigs = new ProjectConfig[configsMap.Keys.Count]; } configsMap.Values.CopyTo(_projectConfigs, 0); } } if (_active && _project != null) { BindProperties(); IsDirty = false; } }