Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/02/12 15:32:40 (13 years ago)
Author:
ascheibe
Message:

#1725

  • moved Hive resources to HL common resources
  • added missing invokes and usings for displaying the hive information dialog


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs

    r7250 r7256  
    5151    public ResourcesView() {
    5252      InitializeComponent();
    53       treeSlaveGroup.ImageList.Images.Add(HiveImageLibrary.Slave);
    54       treeSlaveGroup.ImageList.Images.Add(HiveImageLibrary.SlaveGroup);
     53      treeSlaveGroup.ImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.MonitorLarge);
     54      treeSlaveGroup.ImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.NetworkCenterLarge);
    5555
    5656      HiveAdminClient.Instance.Refreshing += new EventHandler(Instance_Refreshing);
     
    346346
    347347    void ResetView() {
    348       treeSlaveGroup.Nodes.Clear();
    349 
    350       if (slaveView.Content != null && slaveView.Content is SlaveGroup) {
    351         slaveView.Content.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged);
    352       }
    353       slaveView.Content = null;
    354       if (scheduleView.Content != null) {
    355         scheduleView.Content.Clear();
    356       }
    357       HiveAdminClient.Instance.ResetDowntime();
     348      if (this.InvokeRequired) {
     349        Invoke(new Action(ResetView));
     350      } else {
     351        treeSlaveGroup.Nodes.Clear();
     352
     353        if (slaveView.Content != null && slaveView.Content is SlaveGroup) {
     354          slaveView.Content.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged);
     355        }
     356        slaveView.Content = null;
     357        if (scheduleView.Content != null) {
     358          scheduleView.Content.Clear();
     359        }
     360        HiveAdminClient.Instance.ResetDowntime();
     361      }
    358362    }
    359363
    360364    private void UpdateResources() {
    361       if (this.InvokeRequired) {
    362         this.Invoke(new Action(ResetView));
    363       } else {
    364         ResetView();
    365       }
     365      ResetView();
    366366
    367367      try {
     
    370370      }
    371371      catch (MessageSecurityException) {
     372        ShowMessageSecurityException();
     373      }
     374      catch (AnonymousUserException) {
     375        ShowHiveInformationDialog();
     376      }
     377    }
     378
     379    private void ShowMessageSecurityException() {
     380      if (this.InvokeRequired) {
     381        Invoke(new Action(ShowMessageSecurityException));
     382      } else {
    372383        MessageBox.Show("A Message Security error has occured. This normally means that your user name or password is wrong.", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);
    373384      }
    374       catch (AnonymousUserException) {
    375         HiveInformationDialog dialog = new HiveInformationDialog();
    376         dialog.ShowDialog(this);
     385    }
     386
     387    private void ShowHiveInformationDialog() {
     388      if (this.InvokeRequired) {
     389        Invoke(new Action(ShowHiveInformationDialog));
     390      } else {
     391        using (HiveInformationDialog dialog = new HiveInformationDialog()) {
     392          dialog.ShowDialog(this);
     393        }
    377394      }
    378395    }
Note: See TracChangeset for help on using the changeset viewer.