Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2875: Merged r17180 from trunk to stable

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