Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/09 17:56:06 (15 years ago)
Author:
aleitner
Message:

new Dictionaries for ListViewitems (#508)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Console/HiveServerManagementConsole.cs

    r1174 r1261  
    4747    private ResponseList<User> usersList = null;
    4848
     49    private Dictionary<long, ListViewGroup> clientObjects;
     50    private Dictionary<long, ListViewItem> clientInfoObjects;
     51    private Dictionary<long, ListViewItem> jobObjects;
     52    private Dictionary<long, ListViewGroup> userGroupsObjects;
     53    private Dictionary<long, ListViewItem> userListObjects;
     54
    4955    private Job currentJob = null;
    5056    private ClientInfo currentClient = null;
     
    7379    /// <param name="obj"></param>
    7480    /// <param name="e"></param>
    75     private void TickSync(object obj, EventArgs e) {
    76       Refresh();
     81    private void TickSync(object obj, EventArgs e) { 
     82      updaterWoker.RunWorkerAsync();
    7783    }
    7884
     
    8288    private void AddClients() {
    8389      try {
     90        clientObjects = new Dictionary<long, ListViewGroup>();
     91        clientInfoObjects = new Dictionary<long, ListViewItem>();
    8492        IClientManager clientManager =
    8593          ServiceLocator.GetClientManager();
    8694
    8795        clients = clientManager.GetAllClientGroups();
    88 
    8996        lvClientControl.Items.Clear();
    9097        tvClientControl.Nodes.Clear();
     
    95102          foreach (ClientInfo ci in clientManager.GetAllClients().List) {
    96103            tvClientControl.Nodes[tvClientControl.Nodes.Count - 1].Nodes.Add(ci.Name);
    97             lvClientControl.Items.Add(new ListViewItem(ci.Name, count, lvg));
     104            ListViewItem item = new ListViewItem(ci.Name, count, lvg);
     105            lvClientControl.Items.Add(item);
     106            clientInfoObjects.Add(ci.Id, item);
    98107            count = (count + 1) % 3;
    99108          }
    100109          lvClientControl.Groups.Add(lvg);
     110          clientObjects.Add(cg.Id, lvg);
    101111        } // Groups
    102112
     
    124134    private void AddJobs() {
    125135      try {
     136        jobObjects = new Dictionary<long, ListViewItem>();
    126137        IJobManager jobManager =
    127138          ServiceLocator.GetJobManager();
     
    140151          if (job.State == State.calculating) {
    141152            ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobCalculating);
     153            jobObjects.Add(job.Id, lvi);
    142154            tvJobControl.Nodes[0].Nodes.Add(job.Id.ToString());
    143155            lvJobControl.Items.Add(lvi);
     
    145157          } else if (job.State == State.finished) {
    146158            ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobFinished);
     159            jobObjects.Add(job.Id, lvi);
    147160            tvJobControl.Nodes[1].Nodes.Add(job.Id.ToString());
    148161            lvJobControl.Items.Add(lvi);
    149162          } else if (job.State == State.offline) {
    150163            ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobPending);
     164            jobObjects.Add(job.Id, lvi);
    151165            tvJobControl.Nodes[2].Nodes.Add(job.Id.ToString());
    152166            lvJobControl.Items.Add(lvi);
     
    171185    private void AddUsers() {
    172186      try {
     187        userGroupsObjects = new Dictionary<long, ListViewGroup>();
     188        userListObjects = new Dictionary<long, ListViewItem>();
    173189        IUserRoleManager userRoleManager =
    174190          ServiceLocator.GetUserRoleManager();
     
    187203              User users = permOwner as User;
    188204              tvUserControl.Nodes[tvUserControl.Nodes.Count - 1].Nodes.Add(users.Name);
    189               lvUserControl.Items.Add(new ListViewItem(users.Name, 0, lvg));
     205              ListViewItem item = new ListViewItem(users.Name, 0, lvg);
     206              lvUserControl.Items.Add(item);
     207              userListObjects.Add(users.Id, item);
    190208            }
    191209          }
    192210          lvUserControl.Groups.Add(lvg);
     211          userGroupsObjects.Add(ug.Id, lvg);
    193212
    194213        } // Users
     
    446465      }
    447466    }
     467
     468    private void updaterWoker_DoWork(object sender, DoWorkEventArgs e) {
     469      ResponseList<ClientInfo> clientInfoOld = clientInfo;
     470      IClientManager clientManager =
     471          ServiceLocator.GetClientManager();
     472      clientInfo = clientManager.GetAllClients();
     473      foreach (ClientInfo ci in clientInfo.List) {
     474        foreach (ClientInfo cio in clientInfoOld.List) {
     475          ci.Id.Equals(cio.Id);
     476        }
     477      }
     478     
     479    }
    448480    #endregion
    449 
    450481  }
    451482}
Note: See TracChangeset for help on using the changeset viewer.