- Timestamp:
- 10/04/17 13:56:38 (7 years ago)
- 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
r14125 r15401 159 159 </ItemGroup> 160 160 <ItemGroup> 161 <ProjectReference Include="..\..\HeuristicLab.Clients.Access\3.3\HeuristicLab.Clients.Access-3.3.csproj"> 162 <Project>{494f87f4-0f25-4d33-a382-10cdb2174d48}</Project> 163 <Name>HeuristicLab.Clients.Access-3.3</Name> 164 <Private>False</Private> 165 </ProjectReference> 161 166 <ProjectReference Include="..\..\HeuristicLab.Clients.Hive.Views\3.3\HeuristicLab.Clients.Hive.Views-3.3.csproj"> 162 167 <Project>{E1D6C801-892A-406A-B606-F158E36DD3C3}</Project> -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/JobManagerMenuItem.cs
r14185 r15401 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Windows.Forms; 25 using HeuristicLab.Clients.Access; 24 26 using HeuristicLab.MainForm; 25 27 using HeuristicLab.Optimizer; 26 28 27 29 namespace HeuristicLab.Clients.Hive.JobManager { 28 public class JobManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {30 public class JobManagerMenuItem : MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 29 31 public override string Name { 30 32 get { return "&Job Manager"; } 31 33 } 34 32 35 public override IEnumerable<string> Structure { 33 36 get { return new string[] { "&Services", "&Hive" }; } 34 37 } 38 35 39 public override void Execute() { 36 MainFormManager.MainForm.ShowContent(HiveClient.Instance); 40 if (HiveRoles.CheckHiveUserPermissions()) { 41 MainFormManager.MainForm.ShowContent(HiveClient.Instance); 42 } else if (!UserInformation.Instance.UserExists) { 43 MessageBox.Show( 44 "Couldn't fetch user information from the server." + Environment.NewLine + 45 "Please verify that you have an existing user and that your user name and password is correct.", 46 "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 47 } else { 48 MessageBox.Show( 49 "You do not seem to have the permissions to use the Hive Job Manager." + Environment.NewLine + 50 "If that's not the case or you have any questions please write an email to support@heuristiclab.com", 51 "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); 52 } 37 53 } 54 38 55 public override int Position { 39 56 get { return 10000; } 40 57 } 58 41 59 public override Keys ShortCutKeys { 42 60 get { return Keys.Control | Keys.H; } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.Designer.cs
r14185 r15401 21 21 22 22 namespace HeuristicLab.Clients.Hive.JobManager.Views { 23 partial class Hive ResourceSelector {23 partial class HiveProjectSelector { 24 24 /// <summary> 25 25 /// Required designer variable. … … 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveResourceSelector));49 48 this.resourcesGroupBox = new System.Windows.Forms.GroupBox(); 50 49 this.splitContainer = new System.Windows.Forms.SplitContainer(); … … 71 70 this.resourcesGroupBox.TabIndex = 0; 72 71 this.resourcesGroupBox.TabStop = false; 73 this.resourcesGroupBox.Text = "Available Resources";72 this.resourcesGroupBox.Text = "Available Projects"; 74 73 // 75 74 // splitContainer … … 95 94 // resourcesTreeView 96 95 // 97 this.resourcesTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 98 | System.Windows.Forms.AnchorStyles.Left) 96 this.resourcesTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 97 | System.Windows.Forms.AnchorStyles.Left) 99 98 | System.Windows.Forms.AnchorStyles.Right))); 100 99 this.resourcesTreeView.CheckBoxes = true; … … 128 127 // searchTextBox 129 128 // 130 this.searchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 129 this.searchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 131 130 | System.Windows.Forms.AnchorStyles.Right))); 132 131 this.searchTextBox.Location = new System.Drawing.Point(29, 3); … … 139 138 // descriptionTextBox 140 139 // 141 this.descriptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 142 | System.Windows.Forms.AnchorStyles.Left) 140 this.descriptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 141 | System.Windows.Forms.AnchorStyles.Left) 143 142 | System.Windows.Forms.AnchorStyles.Right))); 144 143 this.descriptionTextBox.Font = new System.Drawing.Font("Courier New", 8.25F); … … 154 153 // HiveResourceSelector 155 154 // 156 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);157 155 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 158 156 this.Controls.Add(this.resourcesGroupBox); -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs
r14185 r15401 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 6Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 using System.Drawing; 25 25 using System.Linq; 26 using System.Text;27 26 using System.Windows.Forms; 28 using HeuristicLab.Clients.Hive.JobManager.ExtensionMethods;29 27 using HeuristicLab.Core; 30 28 using HeuristicLab.Core.Views; … … 33 31 34 32 namespace HeuristicLab.Clients.Hive.JobManager.Views { 35 [View("Hive ResourceSelector View")]36 [Content(typeof(IItemList< Resource>), true)]37 public partial class Hive ResourceSelector : ItemView, IDisposable {38 private const int slaveImageIndex = 0;39 private const int slaveGroupImageIndex = 1;33 [View("Hive Project Selector View")] 34 [Content(typeof(IItemList<Project>), true)] 35 public partial class HiveProjectSelector : ItemView, IDisposable { 36 private const int greenFlagImageIndex = 0; 37 private const int redFlagImageIndex = 1; 40 38 private string currentSearchString; 41 39 private ISet<TreeNode> mainTreeNodes; 42 40 private ISet<TreeNode> filteredTreeNodes; 43 41 private ISet<TreeNode> nodeStore; 44 45 private ISet< Resource> selectedResources;46 public ISet< Resource> SelectedResources {42 43 private ISet<Project> selectedResources; 44 public ISet<Project> SelectedResources { 47 45 get { return selectedResources; } 48 46 set { selectedResources = value; } 49 47 } 50 48 51 public new IItemList<Resource> Content { 52 get { return (IItemList<Resource>)base.Content; } 49 public Project SelectedProject { 50 get { return (Project)resourcesTreeView.SelectedNode.Tag; } 51 } 52 53 public new IItemList<Project> Content { 54 get { return (IItemList<Project>)base.Content; } 53 55 set { base.Content = value; } 54 56 } 55 57 56 public Hive ResourceSelector() {58 public HiveProjectSelector() { 57 59 InitializeComponent(); 58 60 mainTreeNodes = new HashSet<TreeNode>(); 59 61 filteredTreeNodes = new HashSet<TreeNode>(); 60 62 nodeStore = new HashSet<TreeNode>(); 61 selectedResources = new HashSet< Resource>();62 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary. MonitorLarge);63 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary. NetworkCenterLarge);64 } 65 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 66 68 public void StartProgressView() { 67 69 if (InvokeRequired) { 68 70 Invoke(new Action(StartProgressView)); 69 71 } else { 70 var message = "Downloading resources. Please be patient.";72 var message = "Downloading projects. Please be patient."; 71 73 MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message); 72 74 } … … 85 87 86 88 if (Content != null) { 87 selectedResources = new HashSet< Resource>(Content.Where(x => selectedResources.Any(y => x.Id == y.Id)));89 selectedResources = new HashSet<Project>(Content.Where(x => selectedResources.Any(y => x.Id == y.Id))); 88 90 UpdateMainTree(); 89 91 ExtractStatistics(); … … 98 100 mainTreeNodes.Clear(); 99 101 100 foreach (Resource g in Content) { 101 if (g.GetType() == typeof(SlaveGroup)) { 102 //root node 103 if (g.ParentResourceId == null) { 104 TreeNode tn = new TreeNode(); 105 tn.ImageIndex = slaveGroupImageIndex; 106 tn.SelectedImageIndex = tn.ImageIndex; 107 108 tn.Tag = g; 109 tn.Text = g.Name; 110 tn.Checked = selectedResources.Any(x => x.Id == g.Id); 111 112 BuildMainTree(tn); 113 mainTreeNodes.Add(tn); 114 } 102 foreach (Project g in Content.OrderBy(x => x.Name)) { 103 //root node 104 if (g.ParentProjectId == null) { 105 TreeNode tn = new TreeNode(); 106 tn.ImageIndex = greenFlagImageIndex; 107 tn.SelectedImageIndex = tn.ImageIndex; 108 109 tn.Tag = g; 110 tn.Text = g.Name; 111 tn.Checked = selectedResources.Any(x => x.Id == g.Id); 112 113 BuildMainTree(tn); 114 mainTreeNodes.Add(tn); 115 115 } 116 116 } … … 119 119 120 120 private void BuildMainTree(TreeNode tn) { 121 foreach ( Resource r in Content.Where(s => s.ParentResourceId != null && s.ParentResourceId == ((Resource)tn.Tag).Id)) {121 foreach (Project r in Content.Where(s => s.ParentProjectId != null && s.ParentProjectId == ((Project)tn.Tag).Id).OrderBy(x => x.Name)) { 122 122 TreeNode stn = new TreeNode(r.Name); 123 if (r is Slave) stn.ImageIndex = slaveImageIndex; 124 else if (r is SlaveGroup) stn.ImageIndex = slaveGroupImageIndex; 123 stn.ImageIndex = redFlagImageIndex; 125 124 stn.SelectedImageIndex = stn.ImageIndex; 126 125 stn.Tag = r; … … 139 138 foreach (TreeNode n in mainTreeNodes) { 140 139 n.BackColor = SystemColors.Window; 141 if (currentSearchString == null || (( Resource)n.Tag).Name.ToLower().Contains(currentSearchString)) {140 if (currentSearchString == null || ((Project)n.Tag).Name.ToLower().Contains(currentSearchString)) { 142 141 n.BackColor = string.IsNullOrEmpty(currentSearchString) ? SystemColors.Window : Color.LightBlue; 143 142 filteredTreeNodes.Add(n); … … 162 161 163 162 foreach (TreeNode node in filteredTreeNodes) { 164 var clone = nodeStore.SingleOrDefault(x => (( Resource)x.Tag).Id == ((Resource)node.Tag).Id);163 var clone = nodeStore.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)node.Tag).Id); 165 164 if (clone == null) { 166 165 clone = (TreeNode)node.Clone(); … … 169 168 } 170 169 foreach (TreeNode child in node.Nodes) 171 if (filteredTreeNodes.Any(x => (( Resource)x.Tag).Id == ((Resource)child.Tag).Id)) {172 var childClone = nodeStore.SingleOrDefault(x => (( Resource)x.Tag).Id == ((Resource)child.Tag).Id);170 if (filteredTreeNodes.Any(x => ((Project)x.Tag).Id == ((Project)child.Tag).Id)) { 171 var childClone = nodeStore.SingleOrDefault(x => ((Project)x.Tag).Id == ((Project)child.Tag).Id); 173 172 if (childClone == null) { 174 173 childClone = (TreeNode)child.Clone(); … … 179 178 } 180 179 } 181 resourcesTreeView.Nodes.AddRange(nodeStore.Where(x => (( Resource)x.Tag).ParentResourceId == null).ToArray());180 resourcesTreeView.Nodes.AddRange(nodeStore.Where(x => ((Project)x.Tag).ParentProjectId == null).ToArray()); 182 181 if (string.IsNullOrEmpty(currentSearchString)) ExpandSlaveGroupNodes(); 183 182 else resourcesTreeView.ExpandAll(); … … 187 186 #region Events 188 187 private void resourcesTreeView_AfterCheck(object sender, TreeViewEventArgs e) { 189 if (e.Action != TreeViewAction.Unknown) {190 if (e.Node.Checked) {191 IncludeChildNodes(mainTreeNodes.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)e.Node.Tag).Id));192 IncludeParentNodes(mainTreeNodes.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)e.Node.Tag).Id));193 } else {194 ExcludeChildNodes(mainTreeNodes.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)e.Node.Tag).Id));195 ExcludeParentNodes(mainTreeNodes.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)e.Node.Tag).Id));196 }197 ExtractStatistics();198 }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 //} 199 198 } 200 199 … … 212 211 213 212 #region Helpers 214 private void IncludeChildNodes(TreeNode node) {215 if (node != null) {216 node.Checked = true;217 selectedResources.Add((Resource)node.Tag);218 AdjustNodeCheckedState(node);219 foreach (TreeNode n in node.Nodes) IncludeChildNodes(n);220 }221 }222 223 private void IncludeParentNodes(TreeNode node) {224 if (node != null && node.Parent != null) {225 TreeNode parent = node.Parent;226 if (parent.Nodes.OfType<TreeNode>().All(x => x.Checked)) {227 parent.Checked = true;228 selectedResources.Add((Resource)parent.Tag);229 AdjustNodeCheckedState(parent);230 IncludeParentNodes(parent);231 }232 }233 }234 235 private void ExcludeChildNodes(TreeNode node) {236 if (node != null) {237 node.Checked = false;238 selectedResources.Remove((Resource)node.Tag);239 AdjustNodeCheckedState(node);240 foreach (TreeNode n in node.Nodes) ExcludeChildNodes(n);241 }242 }243 244 private void ExcludeParentNodes(TreeNode node) {245 if (node != null) {246 node.Checked = false;247 selectedResources.Remove((Resource)node.Tag);248 AdjustNodeCheckedState(node);249 ExcludeParentNodes(node.Parent);250 }251 }252 253 private void AdjustNodeCheckedState(TreeNode node) {254 var filterdNode = filteredTreeNodes.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)node.Tag).Id);255 var storedNode = nodeStore.SingleOrDefault(x => ((Resource)x.Tag).Id == ((Resource)node.Tag).Id);256 if (filterdNode != null) filterdNode.Checked = node.Checked;257 if (storedNode != null) storedNode.Checked = node.Checked;258 }259 260 213 private void ExpandSlaveGroupNodes() { 261 214 foreach (TreeNode n in nodeStore.Where(x => x.Tag is SlaveGroup)) { … … 267 220 268 221 private void ExtractStatistics(TreeNode treeNode = null) { 269 StringBuilder sb = new StringBuilder();270 Resource resource = treeNode == null ? null : treeNode.Tag as Resource;271 ISet<Resource> resources = treeNode == null ? selectedResources : new HashSet<Resource>(treeNode.DescendantNodes().Select(x => x.Tag as Resource)); ;272 IEnumerable<SlaveGroup> slaveGroups = resources.OfType<SlaveGroup>();273 IEnumerable<Slave> slaves = resources.OfType<Slave>();274 int cpuSpeed = 0, cores = 0, freeCores = 0, memory = 0, freeMemory = 0;275 string contextString = treeNode == null ? "Selected" : "Included";276 277 if (resources.Any() || resource != null) {278 foreach (Slave s in slaves) {279 cpuSpeed += s.CpuSpeed.GetValueOrDefault();280 cores += s.Cores.GetValueOrDefault();281 freeCores += s.FreeCores.GetValueOrDefault();282 memory += s.Memory.GetValueOrDefault();283 freeMemory += s.FreeMemory.GetValueOrDefault();284 }285 if (resource != null) {286 if (resource is SlaveGroup) sb.Append("Slave group: ");287 else if (resource is Slave) {288 sb.Append("Slave: ");289 if (!resources.Any()) {290 Slave s = resource as Slave;291 cpuSpeed = s.CpuSpeed.GetValueOrDefault();292 cores = s.Cores.GetValueOrDefault();293 freeCores = s.FreeCores.GetValueOrDefault();294 memory = s.Memory.GetValueOrDefault();295 freeMemory = s.FreeMemory.GetValueOrDefault();296 }297 }298 sb.AppendLine(string.Format("{0}", resource.Name));299 }300 if (resource == null || resource is SlaveGroup) {301 if (resources.Any()) {302 sb.AppendFormat("{0} slave groups ({1}): ", contextString, slaveGroups.Count());303 foreach (SlaveGroup sg in slaveGroups) sb.AppendFormat("{0}; ", sg.Name);304 sb.AppendLine();305 sb.AppendFormat("{0} slaves ({1}): ", contextString, slaves.Count());306 foreach (Slave s in slaves) sb.AppendFormat("{0}; ", s.Name);307 sb.AppendLine();308 } else {309 sb.Append("The selection does not inlcude any further resources.");310 }311 }312 sb.AppendLine();313 sb.AppendLine(string.Format("CPU speed: {0} MHz", cpuSpeed));314 if (resources.Any()) sb.AppendLine(string.Format("Avg. CPU speed: {0:0.00} MHz", (double)cpuSpeed / resources.Count()));315 sb.AppendLine(string.Format("Cores: {0}", cores));316 sb.AppendLine(string.Format("Free cores: {0}", freeCores));317 if (resources.Any()) sb.AppendLine(string.Format("Avg. free cores: {0:0.00}", (double)freeCores / resources.Count()));318 sb.AppendLine(string.Format("Memory: {0} MB", memory));319 sb.AppendFormat("Free memory: {0} MB", freeMemory);320 if (resources.Any()) sb.Append(string.Format("{0}Avg. free memory: {1:0.00} MB", Environment.NewLine, (double)freeMemory / resources.Count()));321 } else {322 sb.Append("No resources selected.");323 }324 325 descriptionTextBox.Text = sb.ToString();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(); 326 279 } 327 280 #endregion -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs
r14185 r15401 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveResourceSelectorDialog));48 47 this.okButton = new System.Windows.Forms.Button(); 49 48 this.cancelButton = new System.Windows.Forms.Button(); 50 49 this.refreshButton = new System.Windows.Forms.Button(); 51 this.hiveResourceSelector = new HeuristicLab.Clients.Hive.JobManager.Views.Hive ResourceSelector();50 this.hiveResourceSelector = new HeuristicLab.Clients.Hive.JobManager.Views.HiveProjectSelector(); 52 51 this.SuspendLayout(); 53 52 // … … 87 86 // hiveResourceSelector 88 87 // 89 this.hiveResourceSelector.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 90 | System.Windows.Forms.AnchorStyles.Left) 88 this.hiveResourceSelector.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 89 | System.Windows.Forms.AnchorStyles.Left) 91 90 | System.Windows.Forms.AnchorStyles.Right))); 92 91 this.hiveResourceSelector.Caption = "View"; … … 101 100 // 102 101 this.AcceptButton = this.okButton; 103 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);104 102 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 105 103 this.CancelButton = this.cancelButton; … … 115 113 this.ShowInTaskbar = false; 116 114 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 117 this.Text = "Select Resources";115 this.Text = "Select Project"; 118 116 this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HiveResourceSelectorDialog_FormClosing); 119 117 this.Load += new System.EventHandler(this.HiveResourceSelectorDialog_Load); … … 126 124 protected System.Windows.Forms.Button okButton; 127 125 protected System.Windows.Forms.Button cancelButton; 128 protected Hive ResourceSelector hiveResourceSelector;126 protected HiveProjectSelector hiveResourceSelector; 129 127 protected System.Windows.Forms.Button refreshButton; 130 128 } -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs
r14185 r15401 31 31 } 32 32 33 public ISet<Resource> GetSelectedResources() { return hiveResourceSelector.SelectedResources; } 33 public ISet<Project> GetSelectedResources() { return hiveResourceSelector.SelectedResources; } 34 public Project SelectedProject { get { return hiveResourceSelector.SelectedProject; } } 34 35 35 36 private void HiveResourceSelectorDialog_Load(object sender, System.EventArgs e) { … … 43 44 44 45 void Instance_Refreshed(object sender, System.EventArgs e) { 45 hiveResourceSelector.Content = HiveAdminClient.Instance. Resources;46 hiveResourceSelector.Content = HiveAdminClient.Instance.Projects; 46 47 } 47 48 -
branches/HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r14901 r15401 130 130 nameTextBox.Text = Content.Job.Name; 131 131 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 132 resourceNamesTextBox.Text = Content.Job.ResourceNames;132 //resourceNamesTextBox.Text = Content.Job.ResourceNames; 133 133 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 134 134 logView.Content = Content.Log; … … 337 337 if (hiveResourceSelectorDialog.ShowDialog(this) == DialogResult.OK) { 338 338 StringBuilder sb = new StringBuilder(); 339 foreach (Resource 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; 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; 346 var selectedProject = hiveResourceSelectorDialog.SelectedProject; 347 resourceNamesTextBox.Text = selectedProject.Name; 348 if (Content.Job.ProjectId != selectedProject.Id) 349 Content.Job.ProjectId = selectedProject.Id; 346 350 } 347 351 } … … 404 408 405 409 private void resourceNamesTextBox_Validated(object sender, EventArgs e) { 406 if (!SuppressEvents && Content.Job != null && Content.Job.ResourceNames != resourceNamesTextBox.Text)407 Content.Job.ResourceNames = resourceNamesTextBox.Text;410 //if (!SuppressEvents && Content.Job != null && Content.Job.ResourceNames != resourceNamesTextBox.Text) 411 // Content.Job.ResourceNames = resourceNamesTextBox.Text; 408 412 } 409 413
Note: See TracChangeset
for help on using the changeset viewer.