Changeset 2026 for trunk/sources
- Timestamp:
- 06/05/09 14:43:37 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Hive.Server.Console/3.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/AddJobForm.cs
r1956 r2026 33 33 using HeuristicLab.Hive.JobBase; 34 34 using HeuristicLab.Core; 35 using System.ServiceModel; 35 36 36 37 namespace HeuristicLab.Hive.Server.ServerConsole { … … 58 59 59 60 private void AddJob() { 61 try { 62 60 63 jobManager = 61 64 ServiceLocator.GetJobManager(); … … 74 77 foreach (KeyValuePair<Guid, string> kvp in clients) { 75 78 lbGroupsOut.Items.Add(kvp.Value + " (" + kvp.Key + ")"); 79 } 80 } 81 catch (FaultException fe) { 82 MessageBox.Show(fe.Message); 76 83 } 77 84 -
trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.cs
r2007 r2026 32 32 using HeuristicLab.Hive.Contracts; 33 33 using System.Threading; 34 using System.ServiceModel; 34 35 35 36 namespace HeuristicLab.Hive.Server.ServerConsole { … … 67 68 private IClientManager ClientManager { 68 69 get { 69 return ServiceLocator.GetClientManager(); 70 try { 71 return ServiceLocator.GetClientManager(); 72 } 73 catch (FaultException ex) { 74 MessageBox.Show(ex.Message); 75 } 76 return null; 70 77 } 71 78 } … … 161 168 TreeNode dropNode = (sender as TreeView).GetNodeAt(dropLocation); 162 169 if (((ClientGroup)dropNode.Tag).Id != Guid.Empty) { 163 List<ClientInfo> clients = new List<ClientInfo>();170 Dictionary<ClientInfo, Guid> clients = new Dictionary<ClientInfo, Guid>(); 164 171 foreach (ListViewItem lvi in lvClientControl.SelectedItems) { 165 clients.Add((ClientInfo)lvi.Tag); 172 Guid groupId = Guid.Empty; 173 foreach (ListViewGroup lvg in lvClientGroups) { 174 if (lvi.Group.Header == ((ClientGroup)lvg.Tag).Name) { 175 groupId = ((ClientGroup)lvg.Tag).Id; 176 } 177 } 178 clients.Add((ClientInfo)lvi.Tag, groupId); 166 179 } 167 180 ChangeGroup(clients, ((ClientGroup)dropNode.Tag).Id); … … 173 186 } 174 187 175 private void ChangeGroup( List<ClientInfo> clients, Guid clientgroupID) {188 private void ChangeGroup(Dictionary<ClientInfo, Guid> clients, Guid clientgroupID) { 176 189 IClientManager clientManager = ServiceLocator.GetClientManager(); 177 Guid groupId = ((ClientGroup)currentGroupNode.Tag).Id; 178 foreach (ClientInfo client in clients) { 179 if (groupId != Guid.Empty) { 180 Response resp = clientManager.DeleteResourceFromGroup(groupId, client.Id); 181 } 182 clientManager.AddResourceToGroup(clientgroupID, client); 190 foreach (KeyValuePair<ClientInfo, Guid> client in clients) { 191 if (client.Key.Id != Guid.Empty) { 192 Response resp = clientManager.DeleteResourceFromGroup(client.Value, client.Key.Id); 193 } 194 clientManager.AddResourceToGroup(clientgroupID, client.Key); 183 195 } 184 196 } … … 230 242 #region Job 231 243 ResponseList<Job> jobsOld = jobs; 232 IJobManager jobManager = 233 ServiceLocator.GetJobManager(); 234 235 jobs = jobManager.GetAllJobs(); 236 237 IDictionary<int, Job> jobsOldHelp; 238 CloneList(jobsOld, out jobsOldHelp); 239 240 GetDelta(jobsOld.List, jobsOldHelp); 244 try { 245 IJobManager jobManager = 246 ServiceLocator.GetJobManager(); 247 248 jobs = jobManager.GetAllJobs(); 249 250 IDictionary<int, Job> jobsOldHelp; 251 CloneList(jobsOld, out jobsOldHelp); 252 253 GetDelta(jobsOld.List, jobsOldHelp); 254 255 } 256 catch (FaultException fe) { 257 MessageBox.Show(fe.Message); 258 } 241 259 242 260 #endregion … … 252 270 253 271 /// <summary> 254 /// Adds jobs to ListView and TreeView272 /// Adds Exceptionobs to ListView and TreeView 255 273 /// </summary> 256 274 private void AddJobs() { … … 310 328 } 311 329 330 List<ListViewGroup> lvClientGroups; 312 331 private void AddClients() { 332 lvClientGroups = new List<ListViewGroup>(); 313 333 clientList.Clear(); 314 334 tvClientControl.Nodes.Clear(); 315 316 ResponseList<ClientGroup> clientGroups = ClientManager.GetAllClientGroups(); 317 318 foreach (ClientGroup cg in clientGroups.List) { 319 AddClientOrGroup(cg, null); 320 } 321 322 if (currentGroupNode != null) { 323 lvClientControl.Items.Clear(); 324 lvClientControl.Groups.Clear(); 325 AddGroupsToListView(currentGroupNode); 326 } 327 tvClientControl.ExpandAll(); 335 try { 336 ResponseList<ClientGroup> clientGroups = ClientManager.GetAllClientGroups(); 337 338 foreach (ClientGroup cg in clientGroups.List) { 339 AddClientOrGroup(cg, null); 340 } 341 342 if (currentGroupNode != null) { 343 lvClientControl.Items.Clear(); 344 lvClientControl.Groups.Clear(); 345 AddGroupsToListView(currentGroupNode); 346 } 347 tvClientControl.ExpandAll(); 348 349 } 350 catch (FaultException fe) { 351 MessageBox.Show(fe.Message); 352 } 328 353 } 329 354 … … 338 363 } 339 364 lvClientControl.Groups.Add(lvg); 365 lvg.Tag = clientGroup; 366 lvClientGroups.Add(lvg); 340 367 foreach (Resource resource in clientGroup.Resources) { 341 368 if (resource is ClientInfo) { … … 382 409 ListViewGroup lvg = new ListViewGroup(node.Text, HorizontalAlignment.Left); 383 410 lvClientControl.Groups.Add(lvg); 411 lvg.Tag = node.Tag; 384 412 foreach (ListViewItem item in clientList[((ClientGroup)node.Tag).Id]) { 385 413 item.Group = lvg;
Note: See TracChangeset
for help on using the changeset viewer.