Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/30/10 13:56:28 (14 years ago)
Author:
cneumuel
Message:

Stabilization of Hive, Improvement HiveExperiment GUI (#1115)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/JobItemView.cs

    r4120 r4121  
    3434      base.OnContentChanged();
    3535      if (Content != null) {
     36        Content_JobDtoChanged(this, EventArgs.Empty);
     37        if (Content.LatestSnapshot != null) {
     38          snapshotStatusText.InvokeIfRequired(c => c.Text = Content.LatestSnapshot.StatusMessage);
     39          snapshotTimeText.InvokeIfRequired(c => { c.Text = Content.LatestSnapshotTime.ToString(); });
     40        }
     41      }
     42    }
     43
     44    protected override void RegisterContentEvents() {
     45      base.RegisterContentEvents();
     46      Content.LatestSnapshotChanged += new EventHandler(Content_LatestSnapshotChanged);
     47      Content.JobDtoChanged += new EventHandler(Content_JobDtoChanged);
     48    }
     49
     50    protected override void DeregisterContentEvents() {
     51      Content.LatestSnapshotChanged -= new EventHandler(Content_LatestSnapshotChanged);
     52      Content.JobDtoChanged -= new EventHandler(Content_JobDtoChanged);
     53      base.DeregisterContentEvents();
     54    }
     55
     56    void Content_JobDtoChanged(object sender, EventArgs e) {
     57      if (InvokeRequired) {
     58        Invoke(new EventHandler(Content_JobDtoChanged), sender, e);
     59      } else {
    3660        this.stateTextBox.Text = Content.JobDto.State.ToString();
    3761        this.userIdTextBox.Text = Content.JobDto.UserId.ToString();
    38         this.percentageTextBox.Text = Content.JobDto.Percentage.ToString();
     62        this.percentageTextBox.Text = (Content.JobDto.Percentage*100).ToString() + "%";
     63        this.percentageProgressBar.Value = Convert.ToInt32(Content.JobDto.Percentage * percentageProgressBar.Maximum);
    3964        this.dateCreatedTextBox.Text = Content.JobDto.DateCreated.ToString();
    4065        this.dateCalculatedText.Text = Content.JobDto.DateCalculated.ToString();
     
    4570        this.pluginsNeededTextBox.Text = string.Join(", ", Content.JobDto.PluginsNeeded.Select(x => x.Name + "-" + x.Version).ToArray());
    4671        this.projectTextBox.Text = Content.JobDto.Project != null ? Content.JobDto.Project.Name : "-";
     72      }
     73    }
     74
     75    void Content_LatestSnapshotChanged(object sender, EventArgs e) {
     76      if (InvokeRequired) {
     77        Invoke(new EventHandler(Content_LatestSnapshotChanged), sender, e);
     78      } else {
    4779        if (Content.LatestSnapshot != null) {
    4880          snapshotStatusText.Text = Content.LatestSnapshot.StatusMessage;
    4981          snapshotTimeText.Text = Content.LatestSnapshotTime.ToString();
     82        } else {
     83          snapshotStatusText.Text = "";
     84          snapshotTimeText.Text = "";
    5085        }
     86        SetEnabledStateOfControls();
    5187      }
    52     }
    53 
    54     protected override void RegisterContentEvents() {
    55       base.RegisterContentEvents();
    56       Content.LatestSnapshotChanged += new EventHandler(Content_LatestSnapshotChanged);
    57     }
    58 
    59     protected override void DeregisterContentEvents() {
    60       Content.LatestSnapshotChanged -= new EventHandler(Content_LatestSnapshotChanged);
    61       base.DeregisterContentEvents();
    62     }
    63 
    64     void Content_LatestSnapshotChanged(object sender, EventArgs e) {
    65       if (Content.LatestSnapshot != null) {
    66         snapshotStatusText.Text = Content.LatestSnapshot.StatusMessage;
    67         snapshotTimeText.Text = Content.LatestSnapshotTime.ToString();
    68       } else {
    69         snapshotStatusText.Text = "";
    70         snapshotTimeText.Text = "";
    71       }
    72       SetEnabledStateOfControls();
    7388    }
    7489
     
    7691      base.SetEnabledStateOfControls();
    7792      openSnapshotButton.Enabled = Content != null && Content.LatestSnapshot != null;
     93      this.stateTextBox.ReadOnly = this.ReadOnly;
     94      this.userIdTextBox.ReadOnly = this.ReadOnly;
     95      this.percentageTextBox.ReadOnly = this.ReadOnly;
     96      this.dateCreatedTextBox.ReadOnly = this.ReadOnly;
     97      this.dateCalculatedText.ReadOnly = this.ReadOnly;
     98      this.dateFinishedTextBox.ReadOnly = this.ReadOnly;
     99      this.priorityTextBox.ReadOnly = this.ReadOnly;
     100      this.coresNeededTextBox.ReadOnly = this.ReadOnly;
     101      this.memoryNeededTextBox.ReadOnly = this.ReadOnly;
     102      this.pluginsNeededTextBox.ReadOnly = this.ReadOnly;
     103      this.projectTextBox.ReadOnly = this.ReadOnly;
     104      this.snapshotStatusText.ReadOnly = this.ReadOnly;
     105      this.snapshotTimeText.ReadOnly = this.ReadOnly;
    78106    }
    79107
Note: See TracChangeset for help on using the changeset viewer.