Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/14/11 16:49:58 (14 years ago)
Author:
ascheibe
Message:

#1233 worked on Administration UI

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/Administration/SlaveView.cs

    r5638 r5676  
    2020#endregion
    2121
     22using System;
    2223using System.Windows.Forms;
    2324using HeuristicLab.Core.Views;
     
    2728namespace HeuristicLab.Clients.Hive.Views.Administration {
    2829  [View("SlaveView")]
    29   [Content(typeof(Slave), IsDefaultView = true)]
     30  [Content(typeof(Resource), IsDefaultView = true)]
    3031  public partial class SlaveView : ItemView {
    31     public new Slave Content {
    32       get { return (Slave)base.Content; }
     32    public new Resource Content {
     33      get { return (Resource)base.Content; }
    3334      set { base.Content = value; }
    3435    }
     
    5051      base.OnContentChanged();
    5152      if (Content == null) {
     53        ShowSlaveUI(true);
    5254        txtName.Clear();
    5355        txtCPU.Clear();
     
    6062        txtId.Clear();
    6163      } else {
    62         txtName.Text = Content.Name;
    63         txtCPU.Text = Content.Cores.ToString() + " Cores @ " + Content.CpuSpeed.ToString() + " Mhz, Arch.: " + Content.CpuArchitecture.ToString();
    64         txtDetailsDescription.Text = Content.Description;
    65         txtMemory.Text = Content.Memory.ToString();
    66         txtOS.Text = Content.OperatingSystem;
    67         txtSlaveState.Text = Content.SlaveState.ToString();
    68         txtLastHeartbeat.Text = Content.LastHeartbeat.ToString();
    69         txtFreeMemory.Text = Content.FreeMemory.ToString();
    70         txtId.Text = Content.Id.ToString();
     64        if (Content.GetType() == typeof(Slave)) {
     65          ShowSlaveUI(true);
     66          Slave ct = (Slave)Content;
     67          txtName.Text = ct.Name;
     68          txtCPU.Text = ct.Cores.ToString() + " Cores @ " + ct.CpuSpeed.ToString() + " Mhz, Arch.: " + ct.CpuArchitecture.ToString();
     69          txtDetailsDescription.Text = ct.Description;
     70          txtMemory.Text = ct.Memory.ToString();
     71          txtOS.Text = ct.OperatingSystem;
     72          txtSlaveState.Text = ct.SlaveState.ToString();
     73          txtLastHeartbeat.Text = ct.LastHeartbeat.ToString();
     74          txtFreeMemory.Text = ct.FreeMemory.ToString();
     75          txtId.Text = ct.Id.ToString();
     76        } else if (Content.GetType() == typeof(SlaveGroup)) {
     77          SlaveGroup ct = (SlaveGroup)Content;
     78          txtName.Text = ct.Name;
     79          ShowSlaveUI(false);
     80        } else
     81          throw new Exception("Unknown Resource in SlaveView");
     82
    7183      }
     84    }
     85
     86    void txtName_TextChanged(object sender, EventArgs e) {
     87      throw new NotImplementedException();
     88    }
     89
     90    private void ShowSlaveUI(bool show) {
     91      label2.Visible = show;
     92      label1.Visible = show;
     93      label10.Visible = show;
     94      label11.Visible = show;
     95      label12.Visible = show;
     96      label13.Visible = show;
     97      label14.Visible = show;
     98      label15.Visible = show;
     99      txtCPU.Visible = show;
     100      txtDetailsDescription.Visible = show;
     101      txtMemory.Visible = show;
     102      txtOS.Visible = show;
     103      txtSlaveState.Visible = show;
     104      txtLastHeartbeat.Visible = show;
     105      txtFreeMemory.Visible = show;
     106      txtId.Visible = show;
    72107    }
    73108
     
    75110      base.SetEnabledStateOfControls();
    76111    }
     112
     113    private void txtName_TextChanged_1(object sender, EventArgs e) {
     114      if (Content != null && Content is SlaveGroup) {
     115        Content.Name = txtName.Text;
     116      }
     117    }
    77118  }
    78119}
Note: See TracChangeset for help on using the changeset viewer.