1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.ComponentModel;
|
---|
25 | using System.Data;
|
---|
26 | using System.Drawing;
|
---|
27 | using System.Linq;
|
---|
28 | using System.Text;
|
---|
29 | using System.Windows.Forms;
|
---|
30 | using HeuristicLab.Hive.Contracts.Interfaces;
|
---|
31 | using HeuristicLab.Hive.Contracts.BusinessObjects;
|
---|
32 |
|
---|
33 | namespace HeuristicLab.Hive.Server.Console {
|
---|
34 |
|
---|
35 | public delegate void closeForm(bool cf);
|
---|
36 |
|
---|
37 | public partial class HiveServerManagementConsole : Form {
|
---|
38 |
|
---|
39 | public event closeForm closeFormEvent;
|
---|
40 |
|
---|
41 | List<ClientGroup> clients = null;
|
---|
42 | List<Job> jobs = null;
|
---|
43 | List<UserGroup> userGroups = null;
|
---|
44 |
|
---|
45 | public HiveServerManagementConsole() {
|
---|
46 | InitializeComponent();
|
---|
47 | addItems();
|
---|
48 | }
|
---|
49 |
|
---|
50 | private void addItems() {
|
---|
51 | IClientManager clientManager =
|
---|
52 | ServiceLocator.GetClientManager();
|
---|
53 |
|
---|
54 | IJobManager jobManager =
|
---|
55 | ServiceLocator.GetJobManager();
|
---|
56 |
|
---|
57 | IUserRoleManager userRoleManager =
|
---|
58 | ServiceLocator.GetUserRoleManager();
|
---|
59 |
|
---|
60 | clientManager.GetAllUpTimeStatistics();
|
---|
61 | clients = clientManager.GetAllClientGroups();
|
---|
62 | jobs = jobManager.GetAllJobs();
|
---|
63 | userGroups = userRoleManager.GetAllUserGroups();
|
---|
64 | lvClientControl.Items.Clear();
|
---|
65 | int count = 0;
|
---|
66 | foreach (ClientGroup cg in clients) {
|
---|
67 | tvClientControl.Nodes.Add(cg.Name);
|
---|
68 | ListViewGroup lvg = new ListViewGroup(cg.Name, HorizontalAlignment.Left);
|
---|
69 | lvClientControl.Groups.Add(lvg);
|
---|
70 | foreach (ClientInfo ci in clientManager.GetAllClients()) {
|
---|
71 | tvClientControl.Nodes[tvClientControl.Nodes.Count - 1].Nodes.Add(ci.Name);
|
---|
72 | lvClientControl.Groups[lvClientControl.Groups.Count].Items.Add(new ListViewItem(ci.Name, count));
|
---|
73 | count = (count + 1) % 3;
|
---|
74 | }
|
---|
75 | }
|
---|
76 | foreach (Job job in jobs) {
|
---|
77 | tvJobControl.Nodes.Add(job.JobId.ToString());
|
---|
78 | }
|
---|
79 | foreach (UserGroup ug in userGroups) {
|
---|
80 | tvUserControl.Nodes.Add(ug.UserGroupId.ToString());
|
---|
81 | }
|
---|
82 | }
|
---|
83 |
|
---|
84 | /// <summary>
|
---|
85 | /// Send event to Login-GUI when closing
|
---|
86 | /// </summary>
|
---|
87 | /// <param name="sender"></param>
|
---|
88 | /// <param name="e"></param>
|
---|
89 | private void close_Click(object sender, EventArgs e) {
|
---|
90 | if (closeFormEvent != null) {
|
---|
91 | closeFormEvent(true);
|
---|
92 | }
|
---|
93 | this.Close();
|
---|
94 | }
|
---|
95 |
|
---|
96 | /// <summary>
|
---|
97 | /// Send evnt to Login-GUI when closing
|
---|
98 | /// </summary>
|
---|
99 | /// <param name="sender"></param>
|
---|
100 | /// <param name="e"></param>
|
---|
101 | private void HiveServerConsoleInformation_FormClosing(object sender, FormClosingEventArgs e) {
|
---|
102 | if (closeFormEvent != null) {
|
---|
103 | closeFormEvent(true);
|
---|
104 | }
|
---|
105 |
|
---|
106 | }
|
---|
107 | }
|
---|
108 | } |
---|