[5638] | 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 |
|
---|
[5676] | 22 | using System;
|
---|
[5638] | 23 | using System.Windows.Forms;
|
---|
| 24 | using HeuristicLab.Core.Views;
|
---|
| 25 | using HeuristicLab.MainForm;
|
---|
| 26 | using HeuristicLab.MainForm.WindowsForms;
|
---|
| 27 |
|
---|
| 28 | namespace HeuristicLab.Clients.Hive.Views.Administration {
|
---|
| 29 | [View("SlaveView")]
|
---|
[5676] | 30 | [Content(typeof(Resource), IsDefaultView = true)]
|
---|
[5638] | 31 | public partial class SlaveView : ItemView {
|
---|
[5676] | 32 | public new Resource Content {
|
---|
| 33 | get { return (Resource)base.Content; }
|
---|
[5638] | 34 | set { base.Content = value; }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public SlaveView() {
|
---|
| 38 | InitializeComponent();
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | #region Register Content Events
|
---|
| 42 | protected override void DeregisterContentEvents() {
|
---|
| 43 | base.DeregisterContentEvents();
|
---|
| 44 | }
|
---|
| 45 | protected override void RegisterContentEvents() {
|
---|
| 46 | base.RegisterContentEvents();
|
---|
| 47 | }
|
---|
| 48 | #endregion
|
---|
| 49 |
|
---|
| 50 | protected override void OnContentChanged() {
|
---|
| 51 | base.OnContentChanged();
|
---|
| 52 | if (Content == null) {
|
---|
[5676] | 53 | ShowSlaveUI(true);
|
---|
[5638] | 54 | txtName.Clear();
|
---|
| 55 | txtCPU.Clear();
|
---|
| 56 | txtDetailsDescription.Clear();
|
---|
| 57 | txtMemory.Clear();
|
---|
| 58 | txtOS.Clear();
|
---|
| 59 | txtSlaveState.Clear();
|
---|
| 60 | txtLastHeartbeat.Clear();
|
---|
| 61 | txtFreeMemory.Clear();
|
---|
| 62 | txtId.Clear();
|
---|
| 63 | } else {
|
---|
[5676] | 64 | if (Content.GetType() == typeof(Slave)) {
|
---|
| 65 | ShowSlaveUI(true);
|
---|
| 66 | Slave ct = (Slave)Content;
|
---|
| 67 | txtName.Text = ct.Name;
|
---|
| 68 | txtCPU.Text = ct.Cores.ToString() + " Cores @ " + ct.CpuSpeed.ToString() + " Mhz, Arch.: " + ct.CpuArchitecture.ToString();
|
---|
| 69 | txtDetailsDescription.Text = ct.Description;
|
---|
| 70 | txtMemory.Text = ct.Memory.ToString();
|
---|
| 71 | txtOS.Text = ct.OperatingSystem;
|
---|
| 72 | txtSlaveState.Text = ct.SlaveState.ToString();
|
---|
| 73 | txtLastHeartbeat.Text = ct.LastHeartbeat.ToString();
|
---|
| 74 | txtFreeMemory.Text = ct.FreeMemory.ToString();
|
---|
| 75 | txtId.Text = ct.Id.ToString();
|
---|
| 76 | } else if (Content.GetType() == typeof(SlaveGroup)) {
|
---|
| 77 | SlaveGroup ct = (SlaveGroup)Content;
|
---|
| 78 | txtName.Text = ct.Name;
|
---|
| 79 | ShowSlaveUI(false);
|
---|
| 80 | } else
|
---|
| 81 | throw new Exception("Unknown Resource in SlaveView");
|
---|
| 82 |
|
---|
[5638] | 83 | }
|
---|
| 84 | }
|
---|
| 85 |
|
---|
[5676] | 86 | void txtName_TextChanged(object sender, EventArgs e) {
|
---|
| 87 | throw new NotImplementedException();
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | private void ShowSlaveUI(bool show) {
|
---|
| 91 | label2.Visible = show;
|
---|
| 92 | label1.Visible = show;
|
---|
| 93 | label10.Visible = show;
|
---|
| 94 | label11.Visible = show;
|
---|
| 95 | label12.Visible = show;
|
---|
| 96 | label13.Visible = show;
|
---|
| 97 | label14.Visible = show;
|
---|
| 98 | label15.Visible = show;
|
---|
| 99 | txtCPU.Visible = show;
|
---|
| 100 | txtDetailsDescription.Visible = show;
|
---|
| 101 | txtMemory.Visible = show;
|
---|
| 102 | txtOS.Visible = show;
|
---|
| 103 | txtSlaveState.Visible = show;
|
---|
| 104 | txtLastHeartbeat.Visible = show;
|
---|
| 105 | txtFreeMemory.Visible = show;
|
---|
| 106 | txtId.Visible = show;
|
---|
| 107 | }
|
---|
| 108 |
|
---|
[5638] | 109 | protected override void SetEnabledStateOfControls() {
|
---|
| 110 | base.SetEnabledStateOfControls();
|
---|
| 111 | }
|
---|
[5676] | 112 |
|
---|
| 113 | private void txtName_TextChanged_1(object sender, EventArgs e) {
|
---|
| 114 | if (Content != null && Content is SlaveGroup) {
|
---|
| 115 | Content.Name = txtName.Text;
|
---|
| 116 | }
|
---|
| 117 | }
|
---|
[5638] | 118 | }
|
---|
| 119 | }
|
---|