Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Clients.Access.Views/3.3/ClientViews/ClientView.cs @ 8042

Last change on this file since 8042 was 8042, checked in by ascheibe, 12 years ago

#1648 integrated access service client parts into trunk

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