Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.Clients.Hive.Administrator/3.3/Views/SlaveView.cs @ 18226

Last change on this file since 18226 was 17181, checked in by swagner, 5 years ago

#2875: Merged r17180 from trunk to stable

File size: 2.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 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
22using System;
23using System.Windows.Forms;
24using HeuristicLab.MainForm;
25using HeuristicLab.MainForm.WindowsForms;
26
27namespace HeuristicLab.Clients.Hive.Administrator.Views {
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; }
33      set { base.Content = value; }
34    }
35
36    public SlaveView() {
37      InitializeComponent();
38    }
39
40    #region Overrides
41    protected override void OnContentChanged() {
42      base.OnContentChanged();
43      if (Content == null) {
44        cpuTextBox.Clear();
45        memoryTextBox.Clear();
46        operatingSystemTextBox.Clear();
47        stateTextBox.Clear();
48        lastHeartbeatTextBox.Clear();
49        disposableCheckBox.Checked = false;
50      } else {
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();
57      }
58    }
59
60    protected override void SetEnabledStateOfControls() {
61      base.SetEnabledStateOfControls();
62      bool enabled = Content != null && !Locked;
63      disposableCheckBox.Enabled = enabled;
64    }
65    #endregion
66
67    #region Event Handlers
68    private void disposableCheckBox_CheckedChanged(object sender, EventArgs e) {
69      if (Content != null)
70        Content.IsDisposable = disposableCheckBox.Checked;
71    }
72    #endregion
73  }
74}
Note: See TracBrowser for help on using the repository browser.