[6976] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[16240] | 3 | * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[6976] | 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.Windows.Forms;
|
---|
| 24 | using HeuristicLab.MainForm;
|
---|
| 25 | using HeuristicLab.MainForm.WindowsForms;
|
---|
| 26 |
|
---|
| 27 | namespace HeuristicLab.Clients.Hive.Administrator.Views {
|
---|
[16240] | 28 | [View("Slave View")]
|
---|
| 29 | [Content(typeof(Slave), IsDefaultView = true)]
|
---|
| 30 | public sealed partial class SlaveView : ResourceView {
|
---|
| 31 | public new Slave Content {
|
---|
| 32 | get { return (Slave)base.Content; }
|
---|
[6976] | 33 | set { base.Content = value; }
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | public SlaveView() {
|
---|
| 37 | InitializeComponent();
|
---|
| 38 | }
|
---|
| 39 |
|
---|
[16240] | 40 | #region Overrides
|
---|
[6976] | 41 | protected override void OnContentChanged() {
|
---|
| 42 | base.OnContentChanged();
|
---|
| 43 | if (Content == null) {
|
---|
[16240] | 44 | cpuTextBox.Clear();
|
---|
| 45 | memoryTextBox.Clear();
|
---|
| 46 | operatingSystemTextBox.Clear();
|
---|
| 47 | stateTextBox.Clear();
|
---|
| 48 | lastHeartbeatTextBox.Clear();
|
---|
| 49 | disposableCheckBox.Checked = false;
|
---|
[6976] | 50 | } else {
|
---|
[16240] | 51 | cpuTextBox.Text = string.Format("{0} Cores @ {1} MHz, Arch.: {2}", Content.Cores, Content.CpuSpeed, Content.CpuArchitecture);
|
---|
| 52 | memoryTextBox.Text = string.Format("{0} ({1} Free)", Content.Memory, Content.FreeMemory);
|
---|
| 53 | operatingSystemTextBox.Text = Content.OperatingSystem;
|
---|
| 54 | stateTextBox.Text = Content.SlaveState.ToString();
|
---|
| 55 | lastHeartbeatTextBox.Text = Content.LastHeartbeat.ToString();
|
---|
| 56 | disposableCheckBox.Checked = Content.IsDisposable.GetValueOrDefault();
|
---|
[6976] | 57 | }
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | protected override void SetEnabledStateOfControls() {
|
---|
| 61 | base.SetEnabledStateOfControls();
|
---|
[16240] | 62 | bool enabled = Content != null && !Locked;
|
---|
| 63 | disposableCheckBox.Enabled = enabled;
|
---|
[6976] | 64 | }
|
---|
[16240] | 65 | #endregion
|
---|
[6976] | 66 |
|
---|
[16240] | 67 | #region Event Handlers
|
---|
| 68 | private void disposableCheckBox_CheckedChanged(object sender, EventArgs e) {
|
---|
| 69 | if (Content != null)
|
---|
| 70 | Content.IsDisposable = disposableCheckBox.Checked;
|
---|
[6976] | 71 | }
|
---|
[16240] | 72 | #endregion
|
---|
[6976] | 73 | }
|
---|
| 74 | }
|
---|