Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/07/17 10:32:07 (7 years ago)
Author:
jkarder
Message:

#2839:

  • worked on resources and projects views
  • changed resource selector to be able to select projects and assigned resources
  • updated service clients
Location:
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj

    r15401 r15412  
    164164      <Private>False</Private>
    165165    </ProjectReference>
     166    <ProjectReference Include="..\..\HeuristicLab.Clients.Common\3.3\HeuristicLab.Clients.Common-3.3.csproj">
     167      <Project>{730a9104-d4d1-4360-966b-e49b7571dda3}</Project>
     168      <Name>HeuristicLab.Clients.Common-3.3</Name>
     169      <Private>False</Private>
     170    </ProjectReference>
    166171    <ProjectReference Include="..\..\HeuristicLab.Clients.Hive.Views\3.3\HeuristicLab.Clients.Hive.Views-3.3.csproj">
    167172      <Project>{E1D6C801-892A-406A-B606-F158E36DD3C3}</Project>
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.Designer.cs

    r15401 r15412  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       this.resourcesGroupBox = new System.Windows.Forms.GroupBox();
    49       this.splitContainer = new System.Windows.Forms.SplitContainer();
    50       this.resourcesTreeView = new System.Windows.Forms.TreeView();
    51       this.imageList = new System.Windows.Forms.ImageList(this.components);
     48      this.projectsGroupBox = new System.Windows.Forms.GroupBox();
     49      this.projectsImageList = new System.Windows.Forms.ImageList(this.components);
     50      this.resourcesImageList = new System.Windows.Forms.ImageList(this.components);
    5251      this.searchLabel = new System.Windows.Forms.Label();
    5352      this.searchTextBox = new System.Windows.Forms.TextBox();
    54       this.descriptionTextBox = new System.Windows.Forms.TextBox();
    5553      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    56       this.resourcesGroupBox.SuspendLayout();
    57       ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    58       this.splitContainer.Panel1.SuspendLayout();
    59       this.splitContainer.Panel2.SuspendLayout();
    60       this.splitContainer.SuspendLayout();
     54      this.splitContainer2 = new System.Windows.Forms.SplitContainer();
     55      this.projectsTreeView = new System.Windows.Forms.TreeView();
     56      this.resourcesTreeView = new System.Windows.Forms.TreeView();
     57      this.summaryGroupBox = new System.Windows.Forms.GroupBox();
     58      this.coresLabel = new System.Windows.Forms.Label();
     59      this.coresSummaryLabel = new System.Windows.Forms.Label();
     60      this.memoryLabel = new System.Windows.Forms.Label();
     61      this.memorySummaryLabel = new System.Windows.Forms.Label();
     62      this.projectsGroupBox.SuspendLayout();
     63      ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
     64      this.splitContainer2.Panel1.SuspendLayout();
     65      this.splitContainer2.Panel2.SuspendLayout();
     66      this.splitContainer2.SuspendLayout();
     67      this.summaryGroupBox.SuspendLayout();
    6168      this.SuspendLayout();
    6269      //
    63       // resourcesGroupBox
    64       //
    65       this.resourcesGroupBox.Controls.Add(this.splitContainer);
    66       this.resourcesGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
    67       this.resourcesGroupBox.Location = new System.Drawing.Point(0, 0);
    68       this.resourcesGroupBox.Name = "resourcesGroupBox";
    69       this.resourcesGroupBox.Size = new System.Drawing.Size(308, 365);
    70       this.resourcesGroupBox.TabIndex = 0;
    71       this.resourcesGroupBox.TabStop = false;
    72       this.resourcesGroupBox.Text = "Available Projects";
    73       //
    74       // splitContainer
    75       //
    76       this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
    77       this.splitContainer.Location = new System.Drawing.Point(3, 16);
    78       this.splitContainer.Name = "splitContainer";
    79       this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
    80       //
    81       // splitContainer.Panel1
    82       //
    83       this.splitContainer.Panel1.Controls.Add(this.resourcesTreeView);
    84       this.splitContainer.Panel1.Controls.Add(this.searchLabel);
    85       this.splitContainer.Panel1.Controls.Add(this.searchTextBox);
    86       //
    87       // splitContainer.Panel2
    88       //
    89       this.splitContainer.Panel2.Controls.Add(this.descriptionTextBox);
    90       this.splitContainer.Size = new System.Drawing.Size(302, 346);
    91       this.splitContainer.SplitterDistance = 219;
    92       this.splitContainer.TabIndex = 0;
    93       //
    94       // resourcesTreeView
    95       //
    96       this.resourcesTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     70      // projectsGroupBox
     71      //
     72      this.projectsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    9773            | System.Windows.Forms.AnchorStyles.Left)
    9874            | System.Windows.Forms.AnchorStyles.Right)));
    99       this.resourcesTreeView.CheckBoxes = true;
    100       this.resourcesTreeView.HideSelection = false;
    101       this.resourcesTreeView.ImageIndex = 0;
    102       this.resourcesTreeView.ImageList = this.imageList;
    103       this.resourcesTreeView.Location = new System.Drawing.Point(3, 29);
    104       this.resourcesTreeView.Name = "resourcesTreeView";
    105       this.resourcesTreeView.SelectedImageIndex = 0;
    106       this.resourcesTreeView.ShowNodeToolTips = true;
    107       this.resourcesTreeView.Size = new System.Drawing.Size(296, 196);
    108       this.resourcesTreeView.TabIndex = 2;
    109       this.resourcesTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.resourcesTreeView_AfterCheck);
    110       this.resourcesTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.resourcesTreeView_AfterSelect);
    111       //
    112       // imageList
    113       //
    114       this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
    115       this.imageList.ImageSize = new System.Drawing.Size(16, 16);
    116       this.imageList.TransparentColor = System.Drawing.Color.Transparent;
     75      this.projectsGroupBox.Controls.Add(this.searchLabel);
     76      this.projectsGroupBox.Controls.Add(this.splitContainer2);
     77      this.projectsGroupBox.Controls.Add(this.searchTextBox);
     78      this.projectsGroupBox.Location = new System.Drawing.Point(3, 3);
     79      this.projectsGroupBox.Name = "projectsGroupBox";
     80      this.projectsGroupBox.Size = new System.Drawing.Size(426, 461);
     81      this.projectsGroupBox.TabIndex = 0;
     82      this.projectsGroupBox.TabStop = false;
     83      this.projectsGroupBox.Text = "Available Projects";
     84      //
     85      // projectsImageList
     86      //
     87      this.projectsImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     88      this.projectsImageList.ImageSize = new System.Drawing.Size(16, 16);
     89      this.projectsImageList.TransparentColor = System.Drawing.Color.Transparent;
     90      //
     91      // resourcesImageList
     92      //
     93      this.resourcesImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     94      this.resourcesImageList.ImageSize = new System.Drawing.Size(16, 16);
     95      this.resourcesImageList.TransparentColor = System.Drawing.Color.Transparent;
    11796      //
    11897      // searchLabel
    11998      //
    12099      this.searchLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Zoom;
    121       this.searchLabel.Location = new System.Drawing.Point(3, 3);
     100      this.searchLabel.Location = new System.Drawing.Point(6, 19);
    122101      this.searchLabel.Name = "searchLabel";
    123102      this.searchLabel.Size = new System.Drawing.Size(20, 20);
     
    129108      this.searchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    130109            | System.Windows.Forms.AnchorStyles.Right)));
    131       this.searchTextBox.Location = new System.Drawing.Point(29, 3);
     110      this.searchTextBox.Location = new System.Drawing.Point(32, 19);
    132111      this.searchTextBox.Name = "searchTextBox";
    133       this.searchTextBox.Size = new System.Drawing.Size(270, 20);
     112      this.searchTextBox.Size = new System.Drawing.Size(388, 20);
    134113      this.searchTextBox.TabIndex = 1;
    135114      this.toolTip.SetToolTip(this.searchTextBox, "Enter string to search for resources");
    136115      this.searchTextBox.TextChanged += new System.EventHandler(this.searchTextBox_TextChanged);
    137116      //
    138       // descriptionTextBox
    139       //
    140       this.descriptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     117      // splitContainer2
     118      //
     119      this.splitContainer2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    141120            | System.Windows.Forms.AnchorStyles.Left)
    142121            | System.Windows.Forms.AnchorStyles.Right)));
    143       this.descriptionTextBox.Font = new System.Drawing.Font("Courier New", 8.25F);
    144       this.descriptionTextBox.Location = new System.Drawing.Point(3, 3);
    145       this.descriptionTextBox.Multiline = true;
    146       this.descriptionTextBox.Name = "descriptionTextBox";
    147       this.descriptionTextBox.ReadOnly = true;
    148       this.descriptionTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
    149       this.descriptionTextBox.Size = new System.Drawing.Size(296, 108);
    150       this.descriptionTextBox.TabIndex = 0;
    151       this.descriptionTextBox.WordWrap = false;
    152       //
    153       // HiveResourceSelector
     122      this.splitContainer2.Location = new System.Drawing.Point(6, 45);
     123      this.splitContainer2.Name = "splitContainer2";
     124      //
     125      // splitContainer2.Panel1
     126      //
     127      this.splitContainer2.Panel1.Controls.Add(this.projectsTreeView);
     128      //
     129      // splitContainer2.Panel2
     130      //
     131      this.splitContainer2.Panel2.Controls.Add(this.resourcesTreeView);
     132      this.splitContainer2.Size = new System.Drawing.Size(414, 410);
     133      this.splitContainer2.SplitterDistance = 204;
     134      this.splitContainer2.TabIndex = 4;
     135      //
     136      // projectsTreeView
     137      //
     138      this.projectsTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
     139      this.projectsTreeView.HideSelection = false;
     140      this.projectsTreeView.ImageIndex = 0;
     141      this.projectsTreeView.ImageList = this.projectsImageList;
     142      this.projectsTreeView.Location = new System.Drawing.Point(0, 0);
     143      this.projectsTreeView.Name = "projectsTreeView";
     144      this.projectsTreeView.SelectedImageIndex = 0;
     145      this.projectsTreeView.ShowNodeToolTips = true;
     146      this.projectsTreeView.Size = new System.Drawing.Size(204, 410);
     147      this.projectsTreeView.TabIndex = 3;
     148      this.projectsTreeView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.projectsTreeView_MouseDoubleClick);
     149      this.projectsTreeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.projectsTreeView_MouseDown);
     150      //
     151      // resourcesTreeView
     152      //
     153      this.resourcesTreeView.CheckBoxes = true;
     154      this.resourcesTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
     155      this.resourcesTreeView.ImageIndex = 0;
     156      this.resourcesTreeView.ImageList = this.resourcesImageList;
     157      this.resourcesTreeView.Location = new System.Drawing.Point(0, 0);
     158      this.resourcesTreeView.Name = "resourcesTreeView";
     159      this.resourcesTreeView.SelectedImageIndex = 0;
     160      this.resourcesTreeView.Size = new System.Drawing.Size(206, 410);
     161      this.resourcesTreeView.TabIndex = 0;
     162      this.resourcesTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.resourcesTreeView_AfterCheck);
     163      this.resourcesTreeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.resourcesTreeView_MouseDown);
     164      //
     165      // summaryGroupBox
     166      //
     167      this.summaryGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
     168            | System.Windows.Forms.AnchorStyles.Right)));
     169      this.summaryGroupBox.Controls.Add(this.memorySummaryLabel);
     170      this.summaryGroupBox.Controls.Add(this.memoryLabel);
     171      this.summaryGroupBox.Controls.Add(this.coresSummaryLabel);
     172      this.summaryGroupBox.Controls.Add(this.coresLabel);
     173      this.summaryGroupBox.Location = new System.Drawing.Point(3, 470);
     174      this.summaryGroupBox.Name = "summaryGroupBox";
     175      this.summaryGroupBox.Size = new System.Drawing.Size(426, 71);
     176      this.summaryGroupBox.TabIndex = 1;
     177      this.summaryGroupBox.TabStop = false;
     178      this.summaryGroupBox.Text = "Computing Resources";
     179      //
     180      // coresLabel
     181      //
     182      this.coresLabel.AutoSize = true;
     183      this.coresLabel.Location = new System.Drawing.Point(6, 22);
     184      this.coresLabel.Name = "coresLabel";
     185      this.coresLabel.Size = new System.Drawing.Size(37, 13);
     186      this.coresLabel.TabIndex = 1;
     187      this.coresLabel.Text = "Cores:";
     188      //
     189      // coresSummaryLabel
     190      //
     191      this.coresSummaryLabel.AutoSize = true;
     192      this.coresSummaryLabel.Location = new System.Drawing.Point(59, 22);
     193      this.coresSummaryLabel.Name = "coresSummaryLabel";
     194      this.coresSummaryLabel.Size = new System.Drawing.Size(124, 13);
     195      this.coresSummaryLabel.TabIndex = 5;
     196      this.coresSummaryLabel.Text = "0 Total (0 Free / 0 Used)";
     197      //
     198      // memoryLabel
     199      //
     200      this.memoryLabel.AutoSize = true;
     201      this.memoryLabel.Location = new System.Drawing.Point(6, 48);
     202      this.memoryLabel.Name = "memoryLabel";
     203      this.memoryLabel.Size = new System.Drawing.Size(47, 13);
     204      this.memoryLabel.TabIndex = 7;
     205      this.memoryLabel.Text = "Memory:";
     206      //
     207      // memorySummaryLabel
     208      //
     209      this.memorySummaryLabel.AutoSize = true;
     210      this.memorySummaryLabel.Location = new System.Drawing.Point(59, 48);
     211      this.memorySummaryLabel.Name = "memorySummaryLabel";
     212      this.memorySummaryLabel.Size = new System.Drawing.Size(223, 13);
     213      this.memorySummaryLabel.TabIndex = 8;
     214      this.memorySummaryLabel.Text = "0.00 GB Total (0.00 GB Free / 0.00 GB Used)";
     215      //
     216      // HiveProjectSelector
    154217      //
    155218      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    156       this.Controls.Add(this.resourcesGroupBox);
    157       this.Name = "HiveResourceSelector";
    158       this.Size = new System.Drawing.Size(308, 365);
    159       this.resourcesGroupBox.ResumeLayout(false);
    160       this.splitContainer.Panel1.ResumeLayout(false);
    161       this.splitContainer.Panel1.PerformLayout();
    162       this.splitContainer.Panel2.ResumeLayout(false);
    163       this.splitContainer.Panel2.PerformLayout();
    164       ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    165       this.splitContainer.ResumeLayout(false);
     219      this.Controls.Add(this.summaryGroupBox);
     220      this.Controls.Add(this.projectsGroupBox);
     221      this.Name = "HiveProjectSelector";
     222      this.Size = new System.Drawing.Size(432, 544);
     223      this.Load += new System.EventHandler(this.HiveProjectSelector_Load);
     224      this.projectsGroupBox.ResumeLayout(false);
     225      this.projectsGroupBox.PerformLayout();
     226      this.splitContainer2.Panel1.ResumeLayout(false);
     227      this.splitContainer2.Panel2.ResumeLayout(false);
     228      ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
     229      this.splitContainer2.ResumeLayout(false);
     230      this.summaryGroupBox.ResumeLayout(false);
     231      this.summaryGroupBox.PerformLayout();
    166232      this.ResumeLayout(false);
    167233
     
    170236    #endregion
    171237
    172     protected System.Windows.Forms.GroupBox resourcesGroupBox;
    173     protected System.Windows.Forms.SplitContainer splitContainer;
     238    protected System.Windows.Forms.GroupBox projectsGroupBox;
    174239    protected System.Windows.Forms.Label searchLabel;
    175240    protected System.Windows.Forms.TextBox searchTextBox;
     241    protected System.Windows.Forms.ImageList projectsImageList;
     242    protected System.Windows.Forms.ToolTip toolTip;
     243    private System.Windows.Forms.ImageList resourcesImageList;
     244    private System.Windows.Forms.SplitContainer splitContainer2;
     245    protected System.Windows.Forms.TreeView projectsTreeView;
    176246    protected System.Windows.Forms.TreeView resourcesTreeView;
    177     protected System.Windows.Forms.TextBox descriptionTextBox;
    178     protected System.Windows.Forms.ImageList imageList;
    179     protected System.Windows.Forms.ToolTip toolTip;
    180 
     247    private System.Windows.Forms.GroupBox summaryGroupBox;
     248    private System.Windows.Forms.Label coresLabel;
     249    private System.Windows.Forms.Label memorySummaryLabel;
     250    private System.Windows.Forms.Label memoryLabel;
     251    private System.Windows.Forms.Label coresSummaryLabel;
    181252  }
    182253}
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs

    r15401 r15412  
    2525using System.Linq;
    2626using System.Windows.Forms;
     27using HeuristicLab.Collections;
     28using HeuristicLab.Common.Resources;
    2729using HeuristicLab.Core;
    2830using HeuristicLab.Core.Views;
     
    3638    private const int greenFlagImageIndex = 0;
    3739    private const int redFlagImageIndex = 1;
     40    private const int slaveImageIndex = 0;
     41    private const int slaveGroupImageIndex = 1;
     42
     43    private readonly ISet<TreeNode> mainTreeNodes = new HashSet<TreeNode>();
     44    private readonly ISet<TreeNode> filteredTreeNodes = new HashSet<TreeNode>();
     45    private readonly ISet<TreeNode> nodeStore = new HashSet<TreeNode>();
     46    private readonly ISet<Resource> resources = new HashSet<Resource>();
     47
    3848    private string currentSearchString;
    39     private ISet<TreeNode> mainTreeNodes;
    40     private ISet<TreeNode> filteredTreeNodes;
    41     private ISet<TreeNode> nodeStore;
    42 
    43     private ISet<Project> selectedResources;
    44     public ISet<Project> SelectedResources {
    45       get { return selectedResources; }
    46       set { selectedResources = value; }
    47     }
    48 
     49
     50    private Project selectedProject;
    4951    public Project SelectedProject {
    50       get { return (Project)resourcesTreeView.SelectedNode.Tag; }
    51     }
     52      get { return selectedProject; }
     53      set {
     54        if (selectedProject == value) return;
     55        selectedProject = value;
     56        UpdateResources();
     57        OnSelectedProjectChanged();
     58      }
     59    }
     60
     61    private readonly IObservableSet<Resource> selectedResources = new ObservableSet<Resource>();
     62    public IEnumerable<Resource> SelectedResources { get { return selectedResources; } }
    5263
    5364    public new IItemList<Project> Content {
     
    5869    public HiveProjectSelector() {
    5970      InitializeComponent();
    60       mainTreeNodes = new HashSet<TreeNode>();
    61       filteredTreeNodes = new HashSet<TreeNode>();
    62       nodeStore = new HashSet<TreeNode>();
    63       selectedResources = new HashSet<Project>();
    64       imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.FlagGreen);
    65       imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.FlagRed);
    66     }
    67 
    68     public void StartProgressView() {
    69       if (InvokeRequired) {
    70         Invoke(new Action(StartProgressView));
    71       } else {
    72         var message = "Downloading projects. Please be patient.";
    73         MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message);
    74       }
    75     }
    76 
    77     public void FinishProgressView() {
    78       if (InvokeRequired) {
    79         Invoke(new Action(FinishProgressView));
    80       } else {
    81         MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
    82       }
    83     }
    84 
     71
     72      projectsImageList.Images.Add(VSImageLibrary.FlagGreen);
     73      projectsImageList.Images.Add(VSImageLibrary.FlagRed);
     74      resourcesImageList.Images.Add(VSImageLibrary.MonitorLarge);
     75      resourcesImageList.Images.Add(VSImageLibrary.NetworkCenterLarge);
     76    }
     77
     78    #region Overrides
    8579    protected override void OnContentChanged() {
    8680      base.OnContentChanged();
    8781
    8882      if (Content != null) {
    89         selectedResources = new HashSet<Project>(Content.Where(x => selectedResources.Any(y => x.Id == y.Id)));
    9083        UpdateMainTree();
    9184        ExtractStatistics();
     
    9487        UpdateFilteredTree();
    9588      }
    96     }
    97 
    98     #region MainTree Methods
     89
     90      SelectedProject = null;
     91    }
     92    #endregion
     93
     94    #region Event Handlers
     95    private void HiveProjectSelector_Load(object sender, EventArgs e) {
     96      projectsTreeView.Nodes.Clear();
     97      resourcesTreeView.Nodes.Clear();
     98      SelectedProject = null;
     99    }
     100
     101    private void searchTextBox_TextChanged(object sender, EventArgs e) {
     102      currentSearchString = searchTextBox.Text.ToLower();
     103      UpdateFilteredTree();
     104    }
     105
     106    private void projectsTreeView_MouseDoubleClick(object sender, MouseEventArgs e) {
     107      OnProjectsTreeViewDoubleClicked();
     108    }
     109
     110    private void projectsTreeView_MouseDown(object sender, MouseEventArgs e) {
     111      var node = projectsTreeView.GetNodeAt(new Point(e.X, e.Y));
     112
     113      SelectedProject = (Project)node?.Tag;
     114
     115      if (node == null) {
     116        projectsTreeView.SelectedNode = null;
     117      }
     118
     119      ExtractStatistics();
     120    }
     121
     122    private void resourcesTreeView_MouseDown(object sender, MouseEventArgs e) {
     123      var node = resourcesTreeView.GetNodeAt(new Point(e.X, e.Y));
     124
     125      if (node == null) {
     126        resourcesTreeView.SelectedNode = null;
     127      }
     128
     129      ExtractStatistics((Resource)node?.Tag);
     130    }
     131
     132    private void resourcesTreeView_AfterCheck(object sender, TreeViewEventArgs e) {
     133      var resource = (Resource)e.Node.Tag;
     134
     135      if (e.Node.Checked)
     136        selectedResources.Add(resource);
     137      else
     138        selectedResources.Remove(resource);
     139
     140      ExtractStatistics((Resource)resourcesTreeView.SelectedNode?.Tag);
     141      OnSelectedResourcesChanged();
     142    }
     143    #endregion
     144
     145    #region Helpers
    99146    private void UpdateMainTree() {
    100147      mainTreeNodes.Clear();
    101148
    102149      foreach (Project g in Content.OrderBy(x => x.Name)) {
    103         //root node
    104150        if (g.ParentProjectId == null) {
    105151          TreeNode tn = new TreeNode();
     
    131177      }
    132178    }
    133     #endregion
    134 
    135     #region FilteredTree Methods
     179
    136180    private void UpdateFilteredTree() {
    137181      filteredTreeNodes.Clear();
     
    144188        }
    145189      }
    146       UpdateResourceTree();
    147     }
    148 
    149     private void TraverseParentNodes(TreeNode node) {
    150       if (node != null) {
    151         for (TreeNode parent = node.Parent; parent != null; parent = parent.Parent)
    152           filteredTreeNodes.Add(parent);
    153       }
    154     }
    155     #endregion
    156 
    157     #region ResourceTree Methods
    158     private void UpdateResourceTree() {
    159       resourcesTreeView.Nodes.Clear();
     190      UpdateProjectsTree();
     191    }
     192
     193    private void UpdateProjectsTree() {
     194      projectsTreeView.Nodes.Clear();
    160195      nodeStore.Clear();
    161196
     
    178213          }
    179214      }
    180       resourcesTreeView.Nodes.AddRange(nodeStore.Where(x => ((Project)x.Tag).ParentProjectId == null).ToArray());
     215      projectsTreeView.Nodes.AddRange(nodeStore.Where(x => ((Project)x.Tag).ParentProjectId == null).ToArray());
    181216      if (string.IsNullOrEmpty(currentSearchString)) ExpandSlaveGroupNodes();
    182       else resourcesTreeView.ExpandAll();
    183     }
    184     #endregion
    185 
    186     #region Events
    187     private void resourcesTreeView_AfterCheck(object sender, TreeViewEventArgs e) {
    188       //if (e.Action != TreeViewAction.Unknown) {
    189       //  if (e.Node.Checked) {
    190       //    IncludeChildNodes(mainTreeNodes.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)e.Node.Tag).Id));
    191       //    IncludeParentNodes(mainTreeNodes.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)e.Node.Tag).Id));
    192       //  } else {
    193       //    ExcludeChildNodes(mainTreeNodes.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)e.Node.Tag).Id));
    194       //    ExcludeParentNodes(mainTreeNodes.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)e.Node.Tag).Id));
    195       //  }
    196       //  ExtractStatistics();
    197       //}
    198     }
    199 
    200     private void resourcesTreeView_AfterSelect(object sender, TreeViewEventArgs e) {
    201       if (e.Action != TreeViewAction.Unknown) {
    202         ExtractStatistics(e.Node);
    203       }
    204     }
    205 
    206     private void searchTextBox_TextChanged(object sender, System.EventArgs e) {
    207       currentSearchString = searchTextBox.Text.ToLower();
    208       UpdateFilteredTree();
    209     }
    210     #endregion
    211 
    212     #region Helpers
     217      else projectsTreeView.ExpandAll();
     218    }
     219
     220    private void TraverseParentNodes(TreeNode node) {
     221      if (node != null) {
     222        for (TreeNode parent = node.Parent; parent != null; parent = parent.Parent)
     223          filteredTreeNodes.Add(parent);
     224      }
     225    }
     226
     227    private void UpdateResources() {
     228      selectedResources.Clear();
     229
     230      if (selectedProject != null) {
     231        var assignedResources = HiveServiceLocator.Instance.CallHiveService(s => s.GetAssignedResourcesForProject(selectedProject.Id));
     232        var assignedResourceIds = new HashSet<Guid>(assignedResources.Select(x => x.ResourceId));
     233
     234        foreach (var resource in HiveAdminClient.Instance.Resources) {
     235          if (assignedResourceIds.Contains(resource.Id)) {
     236            resources.Add(resource);
     237            selectedResources.Add(resource);
     238          }
     239        }
     240      }
     241
     242      BuildResourceTree(selectedResources);
     243      ExtractStatistics();
     244      OnSelectedResourcesChanged();
     245    }
     246
     247    private Resource BuildResourceTree(IEnumerable<Resource> resources) {
     248      resourcesTreeView.Nodes.Clear();
     249      if (!resources.Any()) return null;
     250
     251      var mainResources = new HashSet<Resource>(resources.Where(x => x.ParentResourceId == null));
     252      var subResources = new HashSet<Resource>(resources.Except(mainResources));
     253
     254      var stack = new Stack<Resource>(mainResources.OrderByDescending(x => x.Name));
     255      var top = stack.Peek();
     256
     257      TreeNode currentNode = null;
     258      Resource currentResource = null;
     259
     260      while (stack.Any()) {
     261        var newResource = stack.Pop();
     262        var newNode = new TreeNode(newResource.Name) {
     263          Checked = true,
     264          ImageIndex = newResource is Slave ? slaveImageIndex : slaveGroupImageIndex,
     265          Tag = newResource
     266        };
     267
     268        while (currentNode != null && newResource.ParentResourceId != currentResource.Id) {
     269          currentNode = currentNode.Parent;
     270          currentResource = currentNode == null ? null : (Resource)currentNode.Tag;
     271        }
     272
     273        if (currentNode == null) {
     274          resourcesTreeView.Nodes.Add(newNode);
     275        } else {
     276          currentNode.Nodes.Add(newNode);
     277        }
     278
     279        newNode.SelectedImageIndex = newNode.ImageIndex;
     280
     281        var childResources = subResources.Where(x => x.ParentResourceId == newResource.Id);
     282        if (childResources.Any()) {
     283          foreach (var resource in childResources.OrderByDescending(x => x.Name)) {
     284            subResources.Remove(resource);
     285            stack.Push(resource);
     286          }
     287          currentNode = newNode;
     288          currentResource = newResource;
     289        }
     290      }
     291
     292      resourcesTreeView.ExpandAll();
     293
     294      return top;
     295    }
     296
    213297    private void ExpandSlaveGroupNodes() {
    214298      foreach (TreeNode n in nodeStore.Where(x => x.Tag is SlaveGroup)) {
     
    219303    }
    220304
    221     private void ExtractStatistics(TreeNode treeNode = null) {
    222       //StringBuilder sb = new StringBuilder();
    223       //Resource resource = treeNode == null ? null : treeNode.Tag as Resource;
    224       //ISet<Resource> resources = treeNode == null ? selectedResources : new HashSet<Resource>(treeNode.DescendantNodes().Select(x => x.Tag as Resource)); ;
    225       //IEnumerable<SlaveGroup> slaveGroups = resources.OfType<SlaveGroup>();
    226       //IEnumerable<Slave> slaves = resources.OfType<Slave>();
    227       //int cpuSpeed = 0, cores = 0, freeCores = 0, memory = 0, freeMemory = 0;
    228       //string contextString = treeNode == null ? "Selected" : "Included";
    229 
    230       //if (resources.Any() || resource != null) {
    231       //  foreach (Slave s in slaves) {
    232       //    cpuSpeed += s.CpuSpeed.GetValueOrDefault();
    233       //    cores += s.Cores.GetValueOrDefault();
    234       //    freeCores += s.FreeCores.GetValueOrDefault();
    235       //    memory += s.Memory.GetValueOrDefault();
    236       //    freeMemory += s.FreeMemory.GetValueOrDefault();
    237       //  }
    238       //  if (resource != null) {
    239       //    if (resource is SlaveGroup) sb.Append("Slave group: ");
    240       //    else if (resource is Slave) {
    241       //      sb.Append("Slave: ");
    242       //      if (!resources.Any()) {
    243       //        Slave s = resource as Slave;
    244       //        cpuSpeed = s.CpuSpeed.GetValueOrDefault();
    245       //        cores = s.Cores.GetValueOrDefault();
    246       //        freeCores = s.FreeCores.GetValueOrDefault();
    247       //        memory = s.Memory.GetValueOrDefault();
    248       //        freeMemory = s.FreeMemory.GetValueOrDefault();
    249       //      }
    250       //    }
    251       //    sb.AppendLine(string.Format("{0}", resource.Name));
    252       //  }
    253       //  if (resource == null || resource is SlaveGroup) {
    254       //    if (resources.Any()) {
    255       //      sb.AppendFormat("{0} slave groups ({1}): ", contextString, slaveGroups.Count());
    256       //      foreach (SlaveGroup sg in slaveGroups) sb.AppendFormat("{0}; ", sg.Name);
    257       //      sb.AppendLine();
    258       //      sb.AppendFormat("{0} slaves ({1}): ", contextString, slaves.Count());
    259       //      foreach (Slave s in slaves) sb.AppendFormat("{0}; ", s.Name);
    260       //      sb.AppendLine();
    261       //    } else {
    262       //      sb.Append("The selection does not inlcude any further resources.");
    263       //    }
    264       //  }
    265       //  sb.AppendLine();
    266       //  sb.AppendLine(string.Format("CPU speed: {0} MHz", cpuSpeed));
    267       //  if (resources.Any()) sb.AppendLine(string.Format("Avg. CPU speed: {0:0.00} MHz", (double)cpuSpeed / resources.Count()));
    268       //  sb.AppendLine(string.Format("Cores: {0}", cores));
    269       //  sb.AppendLine(string.Format("Free cores: {0}", freeCores));
    270       //  if (resources.Any()) sb.AppendLine(string.Format("Avg. free cores: {0:0.00}", (double)freeCores / resources.Count()));
    271       //  sb.AppendLine(string.Format("Memory: {0} MB", memory));
    272       //  sb.AppendFormat("Free memory: {0} MB", freeMemory);
    273       //  if (resources.Any()) sb.Append(string.Format("{0}Avg. free memory: {1:0.00} MB", Environment.NewLine, (double)freeMemory / resources.Count()));
    274       //} else {
    275       //  sb.Append("No resources selected.");
    276       //}
    277 
    278       //descriptionTextBox.Text = sb.ToString();
     305    private void ExtractStatistics(Resource resource = null) {
     306      ISet<Slave> selectedSlaves = null;
     307
     308      if (resource != null) {
     309        var slaveGroup = resource as SlaveGroup;
     310        if (slaveGroup != null) {
     311          var children = new HashSet<Resource>(resources.Where(x => x.ParentResourceId == slaveGroup.Id));
     312          int nrOfChildren = children.Count;
     313          do {
     314            var newChildren = resources.Where(x => children.Any(y => y.Id == x.ParentResourceId));
     315            foreach (var newChild in newChildren)
     316              children.Add(newChild);
     317          } while (children.Count > nrOfChildren);
     318          selectedSlaves = new HashSet<Slave>(children.OfType<Slave>());
     319          selectedSlaves.IntersectWith(selectedResources.OfType<Slave>());
     320        } else {
     321          selectedSlaves = new HashSet<Slave>(new[] { resource as Slave });
     322        }
     323      } else {
     324        selectedSlaves = new HashSet<Slave>(selectedResources.OfType<Slave>());
     325      }
     326
     327      int sumCores = selectedSlaves.OfType<Slave>().Sum(x => x.Cores.GetValueOrDefault());
     328      int sumFreeCores = selectedSlaves.OfType<Slave>().Sum(x => x.FreeCores.GetValueOrDefault());
     329      double sumMemory = selectedSlaves.OfType<Slave>().Sum(x => x.Memory.GetValueOrDefault()) / 1024.0;
     330      double sumFreeMemory = selectedSlaves.OfType<Slave>().Sum(x => x.FreeMemory.GetValueOrDefault()) / 1024.0;
     331
     332      coresSummaryLabel.Text = $"{sumCores} Total ({sumFreeCores} Free / {sumCores - sumFreeCores} Used)";
     333      memorySummaryLabel.Text = $"{sumMemory:0.00} GB Total ({sumFreeMemory:0.00} GB Free / {(sumMemory - sumFreeMemory):0.00} GB Used)";
     334    }
     335    #endregion
     336
     337    #region Events
     338    public event EventHandler SelectedProjectChanged;
     339    private void OnSelectedProjectChanged() {
     340      SelectedProjectChanged?.Invoke(this, EventArgs.Empty);
     341    }
     342
     343    public event EventHandler SelectedResourcesChanged;
     344    private void OnSelectedResourcesChanged() {
     345      SelectedResourcesChanged?.Invoke(this, EventArgs.Empty);
     346    }
     347
     348    public event EventHandler ProjectsTreeViewDoubleClicked;
     349    private void OnProjectsTreeViewDoubleClicked() {
     350      ProjectsTreeViewDoubleClicked?.Invoke(this, EventArgs.Empty);
    279351    }
    280352    #endregion
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs

    r15401 r15412  
    9494      this.hiveResourceSelector.Name = "hiveResourceSelector";
    9595      this.hiveResourceSelector.ReadOnly = false;
     96      this.hiveResourceSelector.SelectedProject = null;
    9697      this.hiveResourceSelector.Size = new System.Drawing.Size(549, 591);
    9798      this.hiveResourceSelector.TabIndex = 0;
     99      this.hiveResourceSelector.SelectedProjectChanged += new System.EventHandler(this.hiveResourceSelector_SelectedProjectChanged);
     100      this.hiveResourceSelector.SelectedResourcesChanged += new System.EventHandler(this.hiveResourceSelector_SelectedResourcesChanged);
     101      this.hiveResourceSelector.ProjectsTreeViewDoubleClicked += new System.EventHandler(this.hiveResourceSelector_ProjectsTreeViewDoubleClicked);
    98102      //
    99103      // HiveResourceSelectorDialog
     
    114118      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
    115119      this.Text = "Select Project";
    116       this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HiveResourceSelectorDialog_FormClosing);
    117120      this.Load += new System.EventHandler(this.HiveResourceSelectorDialog_Load);
    118121      this.ResumeLayout(false);
     
    124127    protected System.Windows.Forms.Button okButton;
    125128    protected System.Windows.Forms.Button cancelButton;
     129    protected System.Windows.Forms.Button refreshButton;
    126130    protected HiveProjectSelector hiveResourceSelector;
    127     protected System.Windows.Forms.Button refreshButton;
    128131  }
    129132}
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs

    r15401 r15412  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    23 using System.Threading.Tasks;
     24using System.ComponentModel;
     25using System.Linq;
    2426using System.Windows.Forms;
    25 using HeuristicLab.PluginInfrastructure;
     27using HeuristicLab.Clients.Hive.Views;
     28using HeuristicLab.MainForm;
    2629
    2730namespace HeuristicLab.Clients.Hive.JobManager.Views {
    2831  public partial class HiveResourceSelectorDialog : Form {
     32    private readonly object locker = new object();
     33    private bool updatingProjects = false;
     34
     35    public Project SelectedProject {
     36      get { return hiveResourceSelector.SelectedProject; }
     37    }
     38
     39    public IEnumerable<Resource> SelectedResources {
     40      get { return hiveResourceSelector.SelectedResources; }
     41    }
     42
    2943    public HiveResourceSelectorDialog() {
    3044      InitializeComponent();
    3145    }
    3246
    33     public ISet<Project> GetSelectedResources() { return hiveResourceSelector.SelectedResources; }
    34     public Project SelectedProject { get { return hiveResourceSelector.SelectedProject; } }
    35 
    36     private void HiveResourceSelectorDialog_Load(object sender, System.EventArgs e) {
    37       HiveAdminClient.Instance.Refreshed += new System.EventHandler(Instance_Refreshed);
    38       DownloadResources();
     47    #region Overrides
     48    protected override void OnLoad(EventArgs e) {
     49      HiveAdminClient.Instance.Refreshing += HiveAdminClient_Instance_Refreshing;
     50      HiveAdminClient.Instance.Refreshed += HiveAdminClient_Instance_Refreshed;
     51      base.OnLoad(e);
    3952    }
    4053
    41     private void HiveResourceSelectorDialog_FormClosing(object sender, FormClosingEventArgs e) {
    42       HiveAdminClient.Instance.Refreshed -= new System.EventHandler(Instance_Refreshed);
     54    protected override void OnClosing(CancelEventArgs e) {
     55      HiveAdminClient.Instance.Refreshed -= HiveAdminClient_Instance_Refreshed;
     56      HiveAdminClient.Instance.Refreshing -= HiveAdminClient_Instance_Refreshing;
     57      base.OnClosing(e);
     58    }
     59    #endregion
     60
     61    #region Event Handlers
     62    private void HiveAdminClient_Instance_Refreshing(object sender, EventArgs e) {
     63      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e);
     64      else {
     65        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     66        mainForm.AddOperationProgressToView(this, "Refreshing ...");
     67        refreshButton.Enabled = false;
     68      }
    4369    }
    4470
    45     void Instance_Refreshed(object sender, System.EventArgs e) {
     71    private void HiveAdminClient_Instance_Refreshed(object sender, EventArgs e) {
     72      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshed, sender, e);
     73      else {
     74        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     75        mainForm.RemoveOperationProgressFromView(this);
     76        refreshButton.Enabled = true;
     77      }
     78    }
     79
     80    private async void HiveResourceSelectorDialog_Load(object sender, EventArgs e) {
     81      lock (locker) {
     82        if (updatingProjects) return;
     83        updatingProjects = true;
     84      }
     85
     86      await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions(
     87        action: () => UpdateProjects(),
     88        finallyCallback: () => updatingProjects = false);
     89    }
     90
     91    private async void refreshButton_Click(object sender, EventArgs e) {
     92      lock (locker) {
     93        if (updatingProjects) return;
     94        updatingProjects = true;
     95      }
     96
     97      await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions(
     98        action: () => UpdateProjects(),
     99        finallyCallback: () => updatingProjects = false);
     100    }
     101
     102    private void hiveResourceSelector_SelectedProjectChanged(object sender, EventArgs e) {
     103      okButton.Enabled = hiveResourceSelector.SelectedProject != null;
     104    }
     105
     106    private void hiveResourceSelector_SelectedResourcesChanged(object sender, EventArgs e) {
     107      okButton.Enabled = hiveResourceSelector.SelectedResources.Any();
     108    }
     109
     110    private void hiveResourceSelector_ProjectsTreeViewDoubleClicked(object sender, EventArgs e) {
     111      if (hiveResourceSelector.SelectedProject == null) return;
     112
     113      DialogResult = DialogResult.OK;
     114      Close();
     115    }
     116    #endregion
     117
     118    #region Helpers
     119    private void UpdateProjects() {
     120      HiveAdminClient.Instance.Refresh();
    46121      hiveResourceSelector.Content = HiveAdminClient.Instance.Projects;
    47122    }
    48123
    49     private void refreshButton_Click(object sender, System.EventArgs e) {
    50       DownloadResources();
     124    private void ShowHiveInformationDialog() {
     125      if (InvokeRequired) Invoke((Action)ShowHiveInformationDialog);
     126      else {
     127        using (HiveInformationDialog dialog = new HiveInformationDialog()) {
     128          dialog.ShowDialog(this);
     129        }
     130      }
    51131    }
    52 
    53     private void DownloadResources() {
    54       var task = System.Threading.Tasks.Task.Factory.StartNew(DownloadResourcesAsync);
    55       task.ContinueWith(t => {
    56         hiveResourceSelector.FinishProgressView();
    57         ErrorHandling.ShowErrorDialog(this, "An error occurred while downloading the tasks.", t.Exception);
    58       }, TaskContinuationOptions.OnlyOnFaulted);
    59     }
    60 
    61     private void DownloadResourcesAsync() {
    62       hiveResourceSelector.StartProgressView();
    63       HiveAdminClient.Instance.Refresh();
    64       hiveResourceSelector.FinishProgressView();
    65     }
     132    #endregion
    66133  }
    67134}
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs

    r14901 r15412  
    5151      this.permissionTabPage = new System.Windows.Forms.TabPage();
    5252      this.refreshPermissionsButton = new System.Windows.Forms.Button();
    53       this.hiveExperimentPermissionListView = new HeuristicLab.Clients.Hive.JobManager.Views.HiveJobPermissionListView();
    5453      this.runsTabPage = new System.Windows.Forms.TabPage();
    5554      this.runCollectionViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     
    6362      this.executionTimeTextBox = new System.Windows.Forms.TextBox();
    6463      this.pauseButton = new System.Windows.Forms.Button();
    65       this.resourceIdsLabel = new System.Windows.Forms.Label();
    66       this.resourceNamesTextBox = new System.Windows.Forms.TextBox();
     64      this.projectLabel = new System.Windows.Forms.Label();
     65      this.projectNameTextBox = new System.Windows.Forms.TextBox();
    6766      this.nameLabel = new System.Windows.Forms.Label();
    6867      this.nameTextBox = new System.Windows.Forms.TextBox();
     
    7978      this.jobsLabel = new System.Windows.Forms.Label();
    8079      this.searchButton = new System.Windows.Forms.Button();
     80      this.hiveExperimentPermissionListView = new HeuristicLab.Clients.Hive.JobManager.Views.HiveJobPermissionListView();
    8181      this.tabControl.SuspendLayout();
    8282      this.tasksTabPage.SuspendLayout();
     
    9191      //
    9292      this.tabControl.AllowDrop = true;
    93       this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    94             | System.Windows.Forms.AnchorStyles.Left)
     93      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     94            | System.Windows.Forms.AnchorStyles.Left) 
    9595            | System.Windows.Forms.AnchorStyles.Right)));
    9696      this.tabControl.Controls.Add(this.tasksTabPage);
     
    119119      //
    120120      this.jobsTreeView.AllowDrop = true;
    121       this.jobsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    122             | System.Windows.Forms.AnchorStyles.Left)
     121      this.jobsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     122            | System.Windows.Forms.AnchorStyles.Left) 
    123123            | System.Windows.Forms.AnchorStyles.Right)));
    124124      this.jobsTreeView.Caption = "ItemTree View";
     
    155155      this.refreshPermissionsButton.Click += new System.EventHandler(this.refreshPermissionsButton_Click);
    156156      //
    157       // hiveExperimentPermissionListView
    158       //
    159       this.hiveExperimentPermissionListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    160             | System.Windows.Forms.AnchorStyles.Left)
    161             | System.Windows.Forms.AnchorStyles.Right)));
    162       this.hiveExperimentPermissionListView.Caption = "HiveExperimentPermissionList View";
    163       this.hiveExperimentPermissionListView.Content = null;
    164       this.hiveExperimentPermissionListView.HiveExperimentId = new System.Guid("00000000-0000-0000-0000-000000000000");
    165       this.hiveExperimentPermissionListView.Location = new System.Drawing.Point(3, 33);
    166       this.hiveExperimentPermissionListView.Name = "hiveExperimentPermissionListView";
    167       this.hiveExperimentPermissionListView.ReadOnly = false;
    168       this.hiveExperimentPermissionListView.ShowDetails = true;
    169       this.hiveExperimentPermissionListView.Size = new System.Drawing.Size(703, 390);
    170       this.hiveExperimentPermissionListView.TabIndex = 0;
    171       //
    172157      // runsTabPage
    173158      //
     
    183168      // runCollectionViewHost
    184169      //
    185       this.runCollectionViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    186             | System.Windows.Forms.AnchorStyles.Left)
     170      this.runCollectionViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     171            | System.Windows.Forms.AnchorStyles.Left) 
    187172            | System.Windows.Forms.AnchorStyles.Right)));
    188173      this.runCollectionViewHost.Caption = "View";
     
    209194      // stateLogViewHost
    210195      //
    211       this.stateLogViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    212             | System.Windows.Forms.AnchorStyles.Left)
     196      this.stateLogViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     197            | System.Windows.Forms.AnchorStyles.Left) 
    213198            | System.Windows.Forms.AnchorStyles.Right)));
    214199      this.stateLogViewHost.Caption = "StateLog View";
     
    235220      // logView
    236221      //
    237       this.logView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    238             | System.Windows.Forms.AnchorStyles.Left)
     222      this.logView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     223            | System.Windows.Forms.AnchorStyles.Left) 
    239224            | System.Windows.Forms.AnchorStyles.Right)));
    240225      this.logView.Caption = "Log View";
     
    302287      this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click);
    303288      //
    304       // resourceIdsLabel
    305       //
    306       this.resourceIdsLabel.AutoSize = true;
    307       this.resourceIdsLabel.Location = new System.Drawing.Point(3, 56);
    308       this.resourceIdsLabel.Name = "resourceIdsLabel";
    309       this.resourceIdsLabel.Size = new System.Drawing.Size(61, 13);
    310       this.resourceIdsLabel.TabIndex = 12;
    311       this.resourceIdsLabel.Text = "Resources:";
    312       //
    313       // resourceNamesTextBox
    314       //
    315       this.resourceNamesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    316             | System.Windows.Forms.AnchorStyles.Right)));
    317       this.resourceNamesTextBox.Location = new System.Drawing.Point(70, 52);
    318       this.resourceNamesTextBox.Name = "resourceNamesTextBox";
    319       this.resourceNamesTextBox.Size = new System.Drawing.Size(471, 20);
    320       this.resourceNamesTextBox.TabIndex = 2;
    321       this.resourceNamesTextBox.Validated += new System.EventHandler(this.resourceNamesTextBox_Validated);
     289      // projectLabel
     290      //
     291      this.projectLabel.AutoSize = true;
     292      this.projectLabel.Location = new System.Drawing.Point(3, 56);
     293      this.projectLabel.Name = "projectLabel";
     294      this.projectLabel.Size = new System.Drawing.Size(43, 13);
     295      this.projectLabel.TabIndex = 12;
     296      this.projectLabel.Text = "Project:";
     297      //
     298      // projectNameTextBox
     299      //
     300      this.projectNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     301            | System.Windows.Forms.AnchorStyles.Right)));
     302      this.projectNameTextBox.Location = new System.Drawing.Point(82, 52);
     303      this.projectNameTextBox.Name = "projectNameTextBox";
     304      this.projectNameTextBox.ReadOnly = true;
     305      this.projectNameTextBox.Size = new System.Drawing.Size(489, 20);
     306      this.projectNameTextBox.TabIndex = 2;
     307      this.projectNameTextBox.Validated += new System.EventHandler(this.resourceNamesTextBox_Validated);
    322308      //
    323309      // nameLabel
     
    332318      // nameTextBox
    333319      //
    334       this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    335             | System.Windows.Forms.AnchorStyles.Right)));
    336       this.nameTextBox.Location = new System.Drawing.Point(70, 27);
     320      this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     321            | System.Windows.Forms.AnchorStyles.Right)));
     322      this.nameTextBox.Location = new System.Drawing.Point(52, 27);
    337323      this.nameTextBox.Name = "nameTextBox";
    338       this.nameTextBox.Size = new System.Drawing.Size(501, 20);
     324      this.nameTextBox.Size = new System.Drawing.Size(519, 20);
    339325      this.nameTextBox.TabIndex = 1;
    340326      this.nameTextBox.Validated += new System.EventHandler(this.nameTextBox_Validated);
     
    391377      // finishedTextBox
    392378      //
    393       this.finishedTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     379      this.finishedTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    394380            | System.Windows.Forms.AnchorStyles.Right)));
    395381      this.finishedTextBox.Location = new System.Drawing.Point(74, 64);
     
    400386      // calculatingTextBox
    401387      //
    402       this.calculatingTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     388      this.calculatingTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    403389            | System.Windows.Forms.AnchorStyles.Right)));
    404390      this.calculatingTextBox.Location = new System.Drawing.Point(74, 40);
     
    409395      // jobsTextBox
    410396      //
    411       this.jobsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     397      this.jobsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    412398            | System.Windows.Forms.AnchorStyles.Right)));
    413399      this.jobsTextBox.Location = new System.Drawing.Point(74, 16);
     
    445431      // searchButton
    446432      //
    447       this.searchButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    448433      this.searchButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Zoom;
    449       this.searchButton.Location = new System.Drawing.Point(547, 50);
     434      this.searchButton.Location = new System.Drawing.Point(52, 50);
    450435      this.searchButton.Name = "searchButton";
    451436      this.searchButton.Size = new System.Drawing.Size(24, 24);
     
    453438      this.searchButton.UseVisualStyleBackColor = true;
    454439      this.searchButton.Click += new System.EventHandler(this.searchButton_Click);
     440      //
     441      // hiveExperimentPermissionListView
     442      //
     443      this.hiveExperimentPermissionListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     444            | System.Windows.Forms.AnchorStyles.Left)
     445            | System.Windows.Forms.AnchorStyles.Right)));
     446      this.hiveExperimentPermissionListView.Caption = "HiveExperimentPermissionList View";
     447      this.hiveExperimentPermissionListView.Content = null;
     448      this.hiveExperimentPermissionListView.HiveExperimentId = new System.Guid("00000000-0000-0000-0000-000000000000");
     449      this.hiveExperimentPermissionListView.Location = new System.Drawing.Point(3, 33);
     450      this.hiveExperimentPermissionListView.Name = "hiveExperimentPermissionListView";
     451      this.hiveExperimentPermissionListView.ReadOnly = false;
     452      this.hiveExperimentPermissionListView.ShowDetails = true;
     453      this.hiveExperimentPermissionListView.Size = new System.Drawing.Size(703, 390);
     454      this.hiveExperimentPermissionListView.TabIndex = 0;
    455455      //
    456456      // RefreshableHiveJobView
     
    468468      this.Controls.Add(this.executionTimeTextBox);
    469469      this.Controls.Add(this.executionTimeLabel);
    470       this.Controls.Add(this.resourceNamesTextBox);
     470      this.Controls.Add(this.projectNameTextBox);
    471471      this.Controls.Add(this.pauseButton);
    472       this.Controls.Add(this.resourceIdsLabel);
     472      this.Controls.Add(this.projectLabel);
    473473      this.Controls.Add(this.stopButton);
    474474      this.Name = "RefreshableHiveJobView";
     
    493493    private System.Windows.Forms.TextBox executionTimeTextBox;
    494494    private System.Windows.Forms.Button pauseButton;
    495     private System.Windows.Forms.Label resourceIdsLabel;
    496     private System.Windows.Forms.TextBox resourceNamesTextBox;
     495    private System.Windows.Forms.Label projectLabel;
     496    private System.Windows.Forms.TextBox projectNameTextBox;
    497497    private System.Windows.Forms.TabPage logTabPage;
    498498    private Core.Views.LogView logView;
  • branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs

    r15401 r15412  
    2323using System.ComponentModel;
    2424using System.Linq;
    25 using System.Text;
    2625using System.Threading;
    2726using System.Threading.Tasks;
     
    118117          nameTextBox.Text = string.Empty;
    119118          executionTimeTextBox.Text = string.Empty;
    120           resourceNamesTextBox.Text = string.Empty;
     119          projectNameTextBox.Text = string.Empty;
    121120          refreshAutomaticallyCheckBox.Checked = false;
    122121          lock (runCollectionViewLocker) {
     
    137136          }
    138137        }
    139       }
    140       finally {
     138      } finally {
    141139        SuppressEvents = false;
    142140      }
     
    158156      tabControl.Enabled = !Locked;
    159157      nameTextBox.Enabled = !Locked;
    160       resourceNamesTextBox.Enabled = !Locked;
     158      projectNameTextBox.Enabled = !Locked;
    161159      searchButton.Enabled = !Locked;
    162160      jobsTreeView.Enabled = !Locked;
     
    183181
    184182          this.nameTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing;
    185           this.resourceNamesTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing;
    186183          this.searchButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Prepared && !alreadyUploaded && !Content.IsProgressing;
    187184          this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing;
     
    335332      if (hiveResourceSelectorDialog == null)
    336333        hiveResourceSelectorDialog = new HiveResourceSelectorDialog();
     334
    337335      if (hiveResourceSelectorDialog.ShowDialog(this) == DialogResult.OK) {
    338         StringBuilder sb = new StringBuilder();
    339         //foreach (Project resource in hiveResourceSelectorDialog.GetSelectedResources()) {
    340         //  sb.Append(resource.Name);
    341         //  sb.Append(";");
    342         //}
    343         //resourceNamesTextBox.Text = sb.ToString();
    344         //if (Content.Job.ResourceNames != resourceNamesTextBox.Text)
    345         //  Content.Job.ResourceNames = resourceNamesTextBox.Text;
    346336        var selectedProject = hiveResourceSelectorDialog.SelectedProject;
    347         resourceNamesTextBox.Text = selectedProject.Name;
    348         if (Content.Job.ProjectId != selectedProject.Id)
    349           Content.Job.ProjectId = selectedProject.Id;
     337        projectNameTextBox.Text = selectedProject.Name;
     338        Content.Job.ProjectId = selectedProject.Id;
     339        Content.Job.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList();
    350340      }
    351341    }
     
    421411        try {
    422412          invoker.EndInvoke(ar);
    423         }
    424         catch (Exception ex) {
    425           ThreadPool.QueueUserWorkItem(delegate(object exception) { ErrorHandling.ShowErrorDialog(this, (Exception)exception); }, ex);
     413        } catch (Exception ex) {
     414          ThreadPool.QueueUserWorkItem(delegate (object exception) { ErrorHandling.ShowErrorDialog(this, (Exception)exception); }, ex);
    426415        }
    427416      }, null);
     
    510499          if (subTask is OptimizerHiveTask) {
    511500            OptimizerHiveTask ohTask = subTask as OptimizerHiveTask;
    512             ohTask.ExecuteReadActionOnItemTask(new Action(delegate() {
     501            ohTask.ExecuteReadActionOnItemTask(new Action(delegate () {
    513502              runs.AddRange(ohTask.ItemTask.Item.Runs);
    514503            }));
Note: See TracChangeset for help on using the changeset viewer.