Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2901_StaticSelectionMethods/HeuristicLab.Clients.Access.Views/3.3/ClientViews/ClientView.cs

Last change on this file was 15583, checked in by swagner, 7 years ago

#2640: Updated year of copyrights in license headers

File size: 3.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 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 HeuristicLab.Core.Views;
23using HeuristicLab.MainForm;
24using HeuristicLab.MainForm.WindowsForms;
25
26namespace HeuristicLab.Clients.Access.Views {
27  [View("Client View")]
28  [Content(typeof(Client), true)]
29  public partial class ClientView : ItemView {
30    public new Client Content {
31      get { return (Client)base.Content; }
32      set { base.Content = value; }
33    }
34
35    public ClientView() {
36      InitializeComponent();
37    }
38
39    protected override void OnContentChanged() {
40      base.OnContentChanged();
41
42      if (Content == null) {
43        txtClientConfiguration.Text = string.Empty;
44        txtClientType.Text = string.Empty;
45        txtDescription.Text = string.Empty;
46        txtMemory.Text = string.Empty;
47        txtName.Text = string.Empty;
48        txtNumberOfCores.Text = string.Empty;
49        txtPerformanceValue.Text = string.Empty;
50        txtProcessor.Text = string.Empty;
51        txtTimestamp.Text = string.Empty;
52        txtVersion.Text = string.Empty;
53        txtId.Text = string.Empty;
54        txtOS.Text = string.Empty;
55      } else {
56        if (Content.ClientConfiguration != null) {
57          txtClientConfiguration.Text = Content.ClientConfiguration.Hash;
58        }
59        if (Content.ClientType != null) {
60          txtClientType.Text = Content.ClientType.Name;
61        }
62        if (Content.OperatingSystem != null) {
63          txtOS.Text = Content.OperatingSystem.Name;
64        }
65        txtDescription.Text = Content.Description;
66        txtMemory.Text = Content.MemorySize.ToString();
67        txtName.Text = Content.Name;
68        txtNumberOfCores.Text = Content.NumberOfCores.ToString();
69        txtPerformanceValue.Text = Content.PerformanceValue.ToString();
70        txtProcessor.Text = Content.ProcessorType;
71        txtTimestamp.Text = Content.Timestamp.ToShortDateString();
72        txtVersion.Text = Content.HeuristicLabVersion;
73        txtId.Text = Content.Id.ToString();
74      }
75    }
76
77    public void StartProgressView() {
78      var message = "Downloading client information. Please be patient.";
79      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message);
80    }
81
82    public void FinishProgressView() {
83      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
84    }
85  }
86}
Note: See TracBrowser for help on using the repository browser.