Changeset 15978 for branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views
- Timestamp:
- 07/02/18 15:51:17 (7 years ago)
- Location:
- branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.Designer.cs
r15956 r15978 147 147 this.projectsTreeView.TabIndex = 3; 148 148 this.projectsTreeView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.projectsTreeView_MouseDoubleClick); 149 this.projectsTreeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.projectsTreeView_BeforeSelect); 149 150 this.projectsTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.projectsTreeView_AfterSelect); 150 151 // -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs
r15966 r15978 227 227 } 228 228 229 private void projectsTreeView_BeforeSelect(object sender, TreeViewCancelEventArgs e) { 230 var node = (Project)e.Node.Tag; 231 if (HiveClient.Instance.DisabledParentProjects.Contains(node)) { 232 e.Cancel = true; 233 } 234 } 235 229 236 private void projectsTreeView_AfterSelect(object sender, TreeViewEventArgs e) { 230 237 var node = (Project)e.Node.Tag; 231 238 232 239 if (node == null) { 233 240 projectsTreeView.SelectedNode = null; 241 } else if (HiveClient.Instance.DisabledParentProjects.Contains(node)) { 242 return; 234 243 } else { 235 244 ResetTreeNodes(projectsTreeView.Nodes); 236 245 e.Node.BackColor = selectedBackColor; 237 246 e.Node.ForeColor = selectedForeColor; 238 239 if (node.Id == projectId) {247 248 if (node.Id == projectId) { 240 249 e.Node.Text += CURRENT_SELECTION_TAG; 241 } else if (projectId == null || projectId == Guid.Empty) {250 } else if (projectId == null || projectId == Guid.Empty) { 242 251 e.Node.Text += NEW_SELECTION_TAG; 243 252 } else { … … 245 254 } 246 255 247 256 248 257 } 249 258 SelectedProject = node; … … 313 322 if (!projects.Any()) return; 314 323 324 var disabledParentProjects = HiveClient.Instance.DisabledParentProjects; 315 325 // select all top level projects (withouth parent, or without any ancestor within current project collection) 316 326 var mainProjects = new HashSet<Project>(projects.Where(x => x.ParentProjectId == null)); 317 var parentedMainProjects = new HashSet<Project>(projects 318 .Where(x => x.ParentProjectId.HasValue 319 && !projects.Select(y => y.Id).Contains(x.ParentProjectId.Value) 320 && !projects.SelectMany(y => HiveClient.Instance.ProjectAncestors[y.Id]).Contains(x.ParentProjectId.Value))); 321 mainProjects.UnionWith(parentedMainProjects); 322 var subProbjects = new HashSet<Project>(projects.Except(mainProjects)); 323 foreach(var p in subProbjects) { 324 p.ParentProjectId = HiveClient.Instance.ProjectAncestors[p.Id].Where(x => projects.Select(y => y.Id).Contains(x)).FirstOrDefault(); 325 } 327 //var parentedMainProjects = new HashSet<Project>(projects 328 // .Where(x => x.ParentProjectId.HasValue 329 // && !projects.Select(y => y.Id).Contains(x.ParentProjectId.Value) 330 // && !projects.SelectMany(y => HiveClient.Instance.ProjectAncestors[y.Id]).Contains(x.ParentProjectId.Value))); 331 //mainProjects.UnionWith(parentedMainProjects); 332 var mainDisabledParentProjects = new HashSet<Project>(disabledParentProjects.Where(x => x.ParentProjectId == null)); 333 mainProjects.UnionWith(mainDisabledParentProjects); 334 var subProbjects = new HashSet<Project>(projects.Union(disabledParentProjects).Except(mainProjects)); 335 //foreach (var p in subProbjects) { 336 // p.ParentProjectId = HiveClient.Instance.ProjectAncestors[p.Id].Where(x => projects.Select(y => y.Id).Contains(x)).FirstOrDefault(); 337 //} 326 338 327 339 var stack = new Stack<Project>(mainProjects.OrderByDescending(x => x.Name)); … … 349 361 newNode.SelectedImageIndex = newNode.ImageIndex; 350 362 351 if (SelectedProject != null && SelectedProject.Id.Equals(newProject.Id)) { 363 if(disabledParentProjects.Contains(newProject)) { 364 newNode.Checked = false; 365 newNode.ForeColor = grayTextColor; 366 } 367 else if (SelectedProject != null && SelectedProject.Id.Equals(newProject.Id)) { 352 368 newNode.BackColor = selectedBackColor; 353 369 newNode.ForeColor = selectedForeColor; … … 673 689 n.BackColor = Color.Transparent; 674 690 n.ForeColor = Color.Black; 691 692 if(n.Tag is Project) { 693 var p = (Project)n.Tag; 694 if(HiveClient.Instance.DisabledParentProjects.Select(x => x.Id).Contains(p.Id)) { 695 n.ForeColor = grayTextColor; 696 } 697 } 675 698 } 676 699
Note: See TracChangeset
for help on using the changeset viewer.