Changeset 15627 for branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views
- Timestamp:
- 01/17/18 15:20:29 (7 years ago)
- Location:
- branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectResourcesView.cs
r15576 r15627 152 152 153 153 private static IEnumerable<Resource> GetAssignedResourcesForProject(Guid projectId) { 154 var assignedProjectResources = HiveServiceLocator.Instance.CallHiveService(s => s.GetAssignedResourcesForProject (projectId));154 var assignedProjectResources = HiveServiceLocator.Instance.CallHiveService(s => s.GetAssignedResourcesForProjectAdministration(projectId)); 155 155 return HiveAdminClient.Instance.Resources.Where(x => assignedProjectResources.Select(y => y.ResourceId).Contains(x.Id)); 156 156 } … … 242 242 243 243 var mainResources = new HashSet<Resource>(resources.OfType<SlaveGroup>().Where(x => x.ParentResourceId == null)); 244 var parentedMainResources = new HashSet<Resource>(resources.OfType<SlaveGroup>() 245 .Where(x => x.ParentResourceId.HasValue && !resources.Select(y => y.Id).Contains(x.ParentResourceId.Value))); 246 mainResources.UnionWith(parentedMainResources); 244 247 var subResources = new HashSet<Resource>(resources.Except(mainResources)); 245 248 246 249 var stack = new Stack<Resource>(mainResources.OrderByDescending(x => x.Name)); 247 var top = stack.Peek();250 Resource top = null; 248 251 249 252 TreeNode currentNode = null; … … 262 265 263 266 while (stack.Any()) { 267 if(top == null) top = stack.Peek(); 264 268 var newResource = stack.Pop(); 265 269 var newNode = new TreeNode(newResource.Name) { Tag = newResource }; -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
r15567 r15627 45 45 private readonly object locker = new object(); 46 46 47 private Project selectedProject = null; 48 47 49 public new IItemList<Project> Content { 48 50 get { return (IItemList<Project>)base.Content; } … … 190 192 191 193 private void addButton_Click(object sender, EventArgs e) { 194 Guid? parentProjectId = null; 195 if (selectedProject != null) parentProjectId = selectedProject.Id; 192 196 var project = new Project { 193 197 Name = "New Project", 194 OwnerUserId = UserInformation.Instance.User.Id 198 OwnerUserId = UserInformation.Instance.User.Id, 199 ParentProjectId = parentProjectId 195 200 }; 196 201 Content.Add(project); … … 244 249 }, 245 250 finallyCallback: () => saveProjectButton.Enabled = true); 251 252 OnContentChanged(); 246 253 } 247 254 248 255 private void projectsTreeView_AfterSelect(object sender, TreeViewEventArgs e) { 249 varselectedProject = (Project)e.Node.Tag;250 ReColorTreeNodes(projectsTreeView.Nodes, selectedColor, Color.Transparent );256 selectedProject = (Project)e.Node.Tag; 257 ReColorTreeNodes(projectsTreeView.Nodes, selectedColor, Color.Transparent, true); 251 258 e.Node.BackColor = selectedColor; 259 e.Node.Text += " [selected]"; 252 260 253 261 254 if (projectView.Content != null)255 projectView.Content.PropertyChanged -= ProjectViewContent_PropertyChanged;262 //if (projectView.Content != null) 263 // projectView.Content.PropertyChanged -= ProjectViewContent_PropertyChanged; 256 264 257 265 projectView.Content = selectedProject; … … 259 267 projectResourcesView.Content = selectedProject; 260 268 261 if (selectedProject != null)262 selectedProject.PropertyChanged += ProjectViewContent_PropertyChanged;269 //if (selectedProject != null) 270 // selectedProject.PropertyChanged += ProjectViewContent_PropertyChanged; 263 271 264 272 if (IsAuthorized(selectedProject)) { … … 322 330 323 331 #region Helpers 324 private void ReColorTreeNodes(TreeNodeCollection nodes, Color c1, Color c2 ) {332 private void ReColorTreeNodes(TreeNodeCollection nodes, Color c1, Color c2, bool resetText) { 325 333 foreach(TreeNode n in nodes) { 326 334 if(n.BackColor.Equals(c1)) { 327 335 n.BackColor = c2; 336 if (resetText) n.Text = ((Project)n.Tag).Name; 328 337 } 329 338 if (n.Nodes.Count > 0) { 330 ReColorTreeNodes(n.Nodes, c1, c2 );339 ReColorTreeNodes(n.Nodes, c1, c2, resetText); 331 340 } 332 341 } … … 338 347 339 348 var mainProjects = new HashSet<Project>(projects.Where(x => x.ParentProjectId == null)); 349 var parentedMainProjects = new HashSet<Project>(projects 350 .Where(x => x.ParentProjectId.HasValue 351 && !projects.Select(y => y.Id).Contains(x.ParentProjectId.Value))); 352 mainProjects.UnionWith(parentedMainProjects); 340 353 var subProbjects = new HashSet<Project>(projects.Except(mainProjects)); 341 354 342 355 var stack = new Stack<Project>(mainProjects.OrderByDescending(x => x.Name)); 343 var top = stack.Peek(); 344 bool first = true; 356 Project top = null; 345 357 346 358 TreeNode currentNode = null; … … 350 362 var newProject = stack.Pop(); 351 363 var newNode = new TreeNode(newProject.Name) { Tag = newProject }; 352 if (first) { 364 if (top == null) { 365 top = newProject; 353 366 newNode.BackColor = selectedColor; 354 first = false;367 newNode.Text += " [selected]"; 355 368 } 356 369
Note: See TracChangeset
for help on using the changeset viewer.