private bool AddBuildDefinition(TeamCityBuildDefinition buildDefinition, ThreeStateTreeNode parentProjectNode, IEnumerable<BuildDefinitionSetting> activeBuildDefinitionSettings) { ThreeStateTreeNode buildDefinitionNode = new ThreeStateTreeNode(buildDefinition.Name) { Tag = buildDefinition }; var buildDefSettings = activeBuildDefinitionSettings.FirstOrDefault(bd => bd.Id == buildDefinition.Id); if (buildDefSettings != null) { buildDefinitionNode.State = buildDefSettings.Active ? CheckBoxState.Checked : CheckBoxState.Unchecked; } parentProjectNode.Nodes.Add(buildDefinitionNode); buildDefinitionNode.UpdateStateOfRelatedNodes(); return buildDefinitionNode.Checked; }
private void LoadBuildDefinitions(TreeNode node) { if (node.Tag is TeamCityProject && node.Nodes.Count == 1 && node.Nodes[0].Text == PLACEHODER_TEXT) { _service.GetBuildDefinitions((TeamCityProject)node.Tag, _userName.Text, _password.Text, buildDefinitions => { ClearProjectNodes(node.Nodes); var activeBuildDefinitionSettings = _ciEntryPointSetting.BuildDefinitionSettings.Where(bd => bd.Active); foreach (TeamCityBuildDefinition buildDefinition in buildDefinitions) { TeamCityBuildDefinition definition = buildDefinition; ThreeStateTreeNode buildDefinitionNode = new ThreeStateTreeNode(buildDefinition.Name) { Tag = buildDefinition }; var buildDefSettings = activeBuildDefinitionSettings.FirstOrDefault(bd => bd.Id == definition.Id); if (buildDefSettings != null) { buildDefinitionNode.State = buildDefSettings.Active ? CheckBoxState.Checked : CheckBoxState.Unchecked; } node.Nodes.Add(buildDefinitionNode); buildDefinitionNode.UpdateStateOfRelatedNodes(); } }); } }