Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2026


Ignore:
Timestamp:
06/05/09 14:43:37 (16 years ago)
Author:
aleitner
Message:

Drag'n'Drop for changing group (also subgroup) for client (#626)

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  
    3333using HeuristicLab.Hive.JobBase;
    3434using HeuristicLab.Core;
     35using System.ServiceModel;
    3536
    3637namespace HeuristicLab.Hive.Server.ServerConsole {
     
    5859
    5960    private void AddJob() {
     61      try {
     62
    6063      jobManager =
    6164        ServiceLocator.GetJobManager();
     
    7477      foreach (KeyValuePair<Guid, string> kvp in clients) {
    7578        lbGroupsOut.Items.Add(kvp.Value + " (" + kvp.Key + ")");
     79      }
     80      }
     81      catch (FaultException fe) {
     82        MessageBox.Show(fe.Message);
    7683      }
    7784
  • trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.cs

    r2007 r2026  
    3232using HeuristicLab.Hive.Contracts;
    3333using System.Threading;
     34using System.ServiceModel;
    3435
    3536namespace HeuristicLab.Hive.Server.ServerConsole {
     
    6768    private IClientManager ClientManager {
    6869      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;
    7077      }
    7178    }
     
    161168          TreeNode dropNode = (sender as TreeView).GetNodeAt(dropLocation);
    162169          if (((ClientGroup)dropNode.Tag).Id != Guid.Empty) {
    163             List<ClientInfo> clients = new List<ClientInfo>();
     170            Dictionary<ClientInfo, Guid> clients = new Dictionary<ClientInfo, Guid>();
    164171            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);
    166179            }
    167180            ChangeGroup(clients, ((ClientGroup)dropNode.Tag).Id);
     
    173186    }
    174187
    175     private void ChangeGroup(List<ClientInfo> clients, Guid clientgroupID) {
     188    private void ChangeGroup(Dictionary<ClientInfo, Guid> clients, Guid clientgroupID) {
    176189      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);
    183195      }
    184196    }
     
    230242      #region Job
    231243      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      }
    241259
    242260      #endregion
     
    252270
    253271    /// <summary>
    254     /// Adds jobs to ListView and TreeView
     272    /// Adds Exceptionobs to ListView and TreeView
    255273    /// </summary>
    256274    private void AddJobs() {
     
    310328    }
    311329
     330    List<ListViewGroup> lvClientGroups;
    312331    private void AddClients() {
     332      lvClientGroups = new List<ListViewGroup>();
    313333      clientList.Clear();
    314334      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      }
    328353    }
    329354
     
    338363      }
    339364      lvClientControl.Groups.Add(lvg);
     365      lvg.Tag = clientGroup;
     366      lvClientGroups.Add(lvg);
    340367      foreach (Resource resource in clientGroup.Resources) {
    341368        if (resource is ClientInfo) {
     
    382409        ListViewGroup lvg = new ListViewGroup(node.Text, HorizontalAlignment.Left);
    383410        lvClientControl.Groups.Add(lvg);
     411        lvg.Tag = node.Tag;
    384412        foreach (ListViewItem item in clientList[((ClientGroup)node.Tag).Id]) {
    385413          item.Group = lvg;
Note: See TracChangeset for help on using the changeset viewer.