Changeset 16211 for trunk


Ignore:
Timestamp:
10/04/18 12:07:10 (11 months ago)
Author:
jzenisek
Message:

#2839:

  • disabled „Start Time“, „End Time“, „All Day Event“ checkbox for non admins
  • reload ProjectResources on change of resources
  • fix bug in ProjectResources regarding ungroupedGroupNode
Location:
trunk/HeuristicLab.Clients.Hive.Administrator/3.3/Views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectResourcesView.cs

    r16202 r16211  
    3030using HeuristicLab.MainForm;
    3131using System.Collections;
     32using HeuristicLab.Common;
    3233
    3334namespace HeuristicLab.Clients.Hive.Administrator.Views {
     
    7273      treeView.ImageList.Images.Add(VSImageLibrary.MonitorLarge);
    7374      treeView.ImageList.Images.Add(VSImageLibrary.NetworkCenterLarge);
     75
     76      HiveAdminClient.Instance.Refreshing += HiveAdminClient_Instance_Refreshing;
     77      HiveAdminClient.Instance.Refreshed += HiveAdminClient_Instance_Refreshed;
    7478    }
    7579
    7680    #region Overrides
     81    protected override void OnClosing(FormClosingEventArgs e) {
     82      HiveAdminClient.Instance.Refreshed -= HiveAdminClient_Instance_Refreshed;
     83      HiveAdminClient.Instance.Refreshing -= HiveAdminClient_Instance_Refreshing;
     84      base.OnClosing(e);
     85    }
     86
    7787    protected override void OnContentChanged() {
    7888      base.OnContentChanged();
     
    106116
    107117    #region Event Handlers
     118    private void HiveAdminClient_Instance_Refreshing(object sender, EventArgs e) {
     119      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e);
     120      else {
     121        SetEnabledStateOfControls();
     122      }
     123    }
     124
     125    private void HiveAdminClient_Instance_Refreshed(object sender, EventArgs e) {
     126      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshed, sender, e);
     127      else {
     128        OnContentChanged();
     129      }
     130    }
     131
    108132    private void ProjectResourcesView_Load(object sender, EventArgs e) {
    109133
     
    385409        }
    386410
    387           if (includedResources.Contains(newResource) && newIncludedResources.Contains(newResource)) {
     411        if (includedResources.Contains(newResource) && newIncludedResources.Contains(newResource)) {
    388412          newNode.Text += INCLUDED_TAG;
    389413        } else if (addedIncludes.Contains(newResource)) {
     
    424448      }
    425449
     450      ExpandResourceNodesOfInterest(treeView.Nodes);
     451
     452      bool expandUngroupedGroupNode = false;
    426453      var ungroupedSlaves = subResources.OfType<Slave>().OrderBy(x => x.Name);
    427454      if(ungroupedSlaves.Any()) {
     
    436463        foreach (var slave in ungroupedSlaves) {
    437464          var slaveNode = new TreeNode(slave.Name) { Tag = slave };
     465          if (newAssignedResources.Contains(slave)) {
     466            slaveNode.Checked = true;
     467            expandUngroupedGroupNode = true;
     468          }
     469
     470          if (!HiveRoles.CheckAdminUserPermissions()) {
     471            slaveNode.ForeColor = SystemColors.GrayText;
     472            slaveNode.Text += IMMUTABLE_TAG;
     473          } else {
     474            if (addedAssignments.Contains(slave)) {
     475              slaveNode.BackColor = addedAssignmentColor;
     476              slaveNode.ForeColor = SystemColors.ControlText;
     477              slaveNode.Text += ADDED_ASSIGNMENT_TAG;
     478            } else if (removedAssignments.Contains(slave)) {
     479              slaveNode.BackColor = removedAssignmentColor;
     480              slaveNode.ForeColor = SystemColors.ControlText;
     481              slaveNode.Text += REMOVED_ASSIGNMENT_TAG;
     482              expandUngroupedGroupNode = true;
     483            }
     484          }
    438485          ungroupedGroupNode.Nodes.Add(slaveNode);
    439486        }
     487
     488        if(expandUngroupedGroupNode) ungroupedGroupNode.Expand();
    440489        treeView.Nodes.Add(ungroupedGroupNode);
    441490      } else if (ungroupedGroupNode != null) {
     
    444493
    445494      treeView.BeforeCheck += treeView_BeforeCheck;
    446       treeView.AfterCheck += treeView_AfterCheck;
    447      
    448       ExpandResourceNodesOfInterest(treeView.Nodes);
     495      treeView.AfterCheck += treeView_AfterCheck;         
    449496
    450497      return top;
  • trunk/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs

    r16117 r16211  
    227227      base.SetEnabledStateOfControls();
    228228      bool enabled = Content != null && !Locked;
     229      dtpFrom.Enabled = enabled;
     230      dtpTo.Enabled = enabled;
     231      chbade.Enabled = enabled;
    229232      btCreate.Enabled = enabled;
    230       btbDelete.Enabled = enabled;
     233      btbDelete.Enabled = enabled;     
     234      btnRecurrence.Enabled = enabled;
    231235      btnClearCal.Enabled = enabled;
    232       btnRecurrence.Enabled = enabled;
    233236      btnSaveCal.Enabled = enabled;
    234237    }
Note: See TracChangeset for help on using the changeset viewer.