Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/11/11 21:54:39 (13 years ago)
Author:
ascheibe
Message:

#1233 some minor improvements in the Slave UI and Administrator UI

Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administrator/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administrator/3.3/HiveAdministratorClient.cs

    r6688 r6734  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    2322using HeuristicLab.Common;
    2423using HeuristicLab.Core;
     
    2726  [Item("Hive Administrator", "Hive Administrator")]
    2827  public class HiveAdministratorClient : Item {
    29     public List<SlaveGroup> SlaveGroups;
    30     public List<Slave> Slaves;
    31 
    3228
    3329    public HiveAdministratorClient() {
    34       UpdateSlaveGroups();
    3530    }
    3631
     
    4237      return new HiveAdministratorClient(this, cloner);
    4338    }
    44 
    45     public void UpdateSlaveGroups() {
    46       ServiceLocator.Instance.CallHiveService(service => {
    47         SlaveGroups = new List<SlaveGroup>(service.GetSlaveGroups());
    48         Slaves = new List<Slave>(service.GetSlaves());
    49       });
    50     }
    5139  }
    5240}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/Common/UpdateControl.cs

    r6721 r6734  
    3232    public Action UpdateAction { get; set; }
    3333
     34    public void Update() {
     35      btnRefresh_Click(this, null);
     36    }
     37
    3438    private void PrivUpdateAction() {
    3539      UpdateAction();
    36       imgBoxProgress.Invoke(new MethodInvoker(() => imgBoxProgress.Visible = false));
     40      if (imgBoxProgress.InvokeRequired) {
     41        imgBoxProgress.Invoke(new MethodInvoker(() => imgBoxProgress.Visible = false));
     42      } else {
     43        imgBoxProgress.Visible = false;
     44      }
    3745    }
    3846
    3947    private void btnRefresh_Click(object sender, EventArgs e) {
    4048      if (UpdateAction != null) {
    41         imgBoxProgress.Visible = true;
     49        if (imgBoxProgress.InvokeRequired) {
     50          imgBoxProgress.Invoke(new MethodInvoker(() => imgBoxProgress.Visible = true));
     51        } else {
     52          imgBoxProgress.Visible = true;
     53        }
     54
    4255        Action action = new Action(PrivUpdateAction);
    4356        TS.Task task = new TS.Task(action);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/HiveAdministratorView.Designer.cs

    r6688 r6734  
    8585      this.Name = "HiveAdministrationView";
    8686      this.Size = new System.Drawing.Size(745, 546);
    87       this.Load += new System.EventHandler(this.HiveAdministrationView_Load);
    8887      this.tabAdmin.ResumeLayout(false);
    8988      this.tabSlaves.ResumeLayout(false);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/HiveAdministratorView.cs

    r6688 r6734  
    2121
    2222using System.Windows.Forms;
    23 using HeuristicLab.Core;
    2423using HeuristicLab.Core.Views;
    2524using HeuristicLab.MainForm;
     
    4039    #region Register Content Events
    4140    protected override void DeregisterContentEvents() {
    42       // TODO: Deregister your event handlers on the Content here
    4341      base.DeregisterContentEvents();
    4442    }
    4543    protected override void RegisterContentEvents() {
    4644      base.RegisterContentEvents();
    47       // TODO: Register your event handlers on the Content here
    4845    }
    4946    #endregion
    5047
    51     private void UpdateResources() {
    52       IItemList<Resource> resources = new ItemList<Resource>();
    53 
    54       foreach (SlaveGroup g in Content.SlaveGroups) {
    55         resources.Add(g);
    56       }
    57       foreach (Slave g in Content.Slaves) {
    58         resources.Add(g);
    59       }
    60       resourcesView.Content = resources;
    61     }
    62 
    6348    protected override void OnContentChanged() {
    6449      base.OnContentChanged();
    65       if (Content == null) {
    66         resourcesView.Content = null;
    67 
    68       } else {
    69         //updateSlaveGroups.UpdateAction = new Action(Content.UpdateSlaveGroups);  //??
    70         UpdateResources();
    71       }
    7250    }
    7351
    7452    protected override void SetEnabledStateOfControls() {
    7553      base.SetEnabledStateOfControls();
    76       // TODO: Put code here to enable or disable controls based on whether the Content is/not null or the view is ReadOnly
    7754    }
    78 
    79     private void HiveAdministrationView_Load(object sender, System.EventArgs e) {
    80       if (Content != null) {
    81 
    82       }
    83     }
    84 
    85     #region Event Handlers
    86     // TODO: Put event handlers here
    87     #endregion
    8855  }
    8956}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs

    r6688 r6734  
    4949      updateScheduleControl.UpdateAction = new Action(UpdateSchedule);
    5050      updateSlaveGroup.UpdateAction = new Action(UpdateSlaveGroups);
    51     }
     51
     52      updateSlaveGroup.Update();
     53    }
     54
    5255
    5356    #region Register Content Events
     
    131134    protected override void SetEnabledStateOfControls() {
    132135      base.SetEnabledStateOfControls();
    133       // TODO: Put code here to enable or disable controls based on whether the Content is/not null or the view is ReadOnly
    134136    }
    135137
     
    293295    void ResetView() {
    294296      treeSlaveGroup.Nodes.Clear();
     297
    295298      if (slaveView.Content != null && slaveView.Content is SlaveGroup) {
    296299        slaveView.Content.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged);
     
    301304
    302305    private void UpdateSlaveGroups() {
    303       this.Invoke(new Action(ResetView));
    304       Content.Clear();
     306      if (this.InvokeRequired) {
     307        this.Invoke(new Action(ResetView));
     308      } else {
     309        ResetView();
     310      }
     311
    305312      IItemList<Resource> resources = new ItemList<Resource>();
    306313
Note: See TracChangeset for help on using the changeset viewer.