[5457] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2011 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.Windows.Forms;
|
---|
| 23 | using HeuristicLab.Clients.Hive.Administration;
|
---|
[5638] | 24 | using HeuristicLab.Core;
|
---|
[5457] | 25 | using HeuristicLab.Core.Views;
|
---|
| 26 | using HeuristicLab.MainForm;
|
---|
| 27 |
|
---|
| 28 | namespace HeuristicLab.Clients.Hive.Views.Administration {
|
---|
| 29 | [View("HiveAdministrationView")]
|
---|
| 30 | [Content(typeof(HiveAdministrationClient), IsDefaultView = true)]
|
---|
| 31 | public partial class HiveAdministrationView : ItemView {
|
---|
| 32 | public new HiveAdministrationClient Content {
|
---|
| 33 | get { return (HiveAdministrationClient)base.Content; }
|
---|
| 34 | set { base.Content = value; }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public HiveAdministrationView() {
|
---|
| 38 | InitializeComponent();
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | #region Register Content Events
|
---|
| 42 | protected override void DeregisterContentEvents() {
|
---|
| 43 | // TODO: Deregister your event handlers on the Content here
|
---|
| 44 | base.DeregisterContentEvents();
|
---|
| 45 | }
|
---|
| 46 | protected override void RegisterContentEvents() {
|
---|
| 47 | base.RegisterContentEvents();
|
---|
| 48 | // TODO: Register your event handlers on the Content here
|
---|
| 49 | }
|
---|
| 50 | #endregion
|
---|
| 51 |
|
---|
[5638] | 52 | private void UpdateResources() {
|
---|
| 53 | IItemList<Resource> resources = new ItemList<Resource>();
|
---|
[5525] | 54 |
|
---|
[5638] | 55 | foreach (SlaveGroup g in Content.SlaveGroups) {
|
---|
| 56 | resources.Add(g);
|
---|
| 57 | }
|
---|
| 58 | foreach (Slave g in Content.Slaves) {
|
---|
| 59 | resources.Add(g);
|
---|
| 60 | }
|
---|
| 61 | resourcesView.Content = resources;
|
---|
| 62 | }
|
---|
| 63 |
|
---|
[5457] | 64 | protected override void OnContentChanged() {
|
---|
| 65 | base.OnContentChanged();
|
---|
| 66 | if (Content == null) {
|
---|
[5638] | 67 | resourcesView.Content = null;
|
---|
| 68 |
|
---|
[5457] | 69 | } else {
|
---|
[5638] | 70 | //updateSlaveGroups.UpdateAction = new Action(Content.UpdateSlaveGroups); //??
|
---|
| 71 | UpdateResources();
|
---|
[5525] | 72 |
|
---|
| 73 | ShowUsers();
|
---|
[5457] | 74 | }
|
---|
| 75 | }
|
---|
| 76 |
|
---|
[5525] | 77 | private void ShowUsers() {
|
---|
| 78 | lstUsers.SmallImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.User);
|
---|
| 79 |
|
---|
| 80 | foreach (string user in Content.Users) {
|
---|
| 81 | ListViewItem lvi = new ListViewItem();
|
---|
| 82 | lvi.Tag = user;
|
---|
| 83 | lvi.Text = user;
|
---|
| 84 | lvi.ImageIndex = 0;
|
---|
| 85 | lstUsers.Items.Add(lvi);
|
---|
| 86 | }
|
---|
| 87 | }
|
---|
| 88 |
|
---|
[5457] | 89 | protected override void SetEnabledStateOfControls() {
|
---|
| 90 | base.SetEnabledStateOfControls();
|
---|
| 91 | // TODO: Put code here to enable or disable controls based on whether the Content is/not null or the view is ReadOnly
|
---|
| 92 | }
|
---|
| 93 |
|
---|
[5472] | 94 | private void HiveAdministrationView_Load(object sender, System.EventArgs e) {
|
---|
[5525] | 95 | if (Content != null) {
|
---|
[5472] | 96 |
|
---|
[5525] | 97 | }
|
---|
| 98 | }
|
---|
[5472] | 99 |
|
---|
[5457] | 100 | #region Event Handlers
|
---|
| 101 | // TODO: Put event handlers here
|
---|
| 102 | #endregion
|
---|
| 103 | }
|
---|
| 104 | }
|
---|