Ignore:
Timestamp:
12/22/17 11:30:52 (3 years ago)
Author:
jzenisek
Message:

#2839 worked views for Projects and ProjectResources

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs

    r15422 r15559  
    4040    private const int greenFlagImageIndex = 0;
    4141    private const int redFlagImageIndex = 1;
     42    private readonly Color changedColor = Color.FromArgb(255, Color.LightGreen);
     43    private readonly Color selectedColor = Color.SkyBlue;
    4244
    4345    private readonly object locker = new object();
     
    246248    private void projectsTreeView_AfterSelect(object sender, TreeViewEventArgs e) {
    247249      var selectedProject = (Project)e.Node.Tag;
     250      ReColorTreeNodes(projectsTreeView.Nodes, selectedColor, Color.Transparent);
     251      e.Node.BackColor = selectedColor;
     252     
    248253
    249254      if (projectView.Content != null)
     
    317322
    318323    #region Helpers
     324    private void ReColorTreeNodes(TreeNodeCollection nodes, Color c1, Color c2) {
     325      foreach(TreeNode n in nodes) {
     326        if(n.BackColor.Equals(c1)) {
     327          n.BackColor = c2;
     328        }
     329        if (n.Nodes.Count > 0) {
     330          ReColorTreeNodes(n.Nodes, c1, c2);
     331        }
     332      }
     333    }
     334
    319335    private Project BuildProjectTree(IEnumerable<Project> projects) {
    320336      projectsTreeView.Nodes.Clear();
     
    326342      var stack = new Stack<Project>(mainProjects.OrderByDescending(x => x.Name));
    327343      var top = stack.Peek();
     344      bool first = true;
    328345
    329346      TreeNode currentNode = null;
    330347      Project currentProject = null;
    331 
     348     
    332349      while (stack.Any()) {
    333350        var newProject = stack.Pop();
    334351        var newNode = new TreeNode(newProject.Name) { Tag = newProject };
     352        if (first) {
     353          newNode.BackColor = selectedColor;
     354          first = false;
     355        }
    335356
    336357        while (currentNode != null && newProject.ParentProjectId != currentProject.Id) {
Note: See TracChangeset for help on using the changeset viewer.