Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8181 for trunk/sources


Ignore:
Timestamp:
07/02/12 16:39:06 (12 years ago)
Author:
abeham
Message:

#1762: Fixed progressView creation

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.cs

    r8165 r8181  
    3232  public partial class OptimizerHiveTaskView : HiveTaskView {
    3333    private Progress progress;
     34    private ProgressView progressView;
    3435
    3536    public new OptimizerHiveTask Content {
     
    6061      base.RegisterContentEvents();
    6162      Content.IsControllableChanged += new EventHandler(Content_IsControllableChanged);
     63      progressView = new ProgressView(this, progress);
    6264    }
    6365
    6466    protected override void DeregisterContentEvents() {
    6567      Content.IsControllableChanged -= new EventHandler(Content_IsControllableChanged);
     68      if (progressView != null) {
     69        progressView.Content = null;
     70        progressView.Dispose();
     71        progressView = null;
     72      }
    6673      base.DeregisterContentEvents();
    6774    }
     
    102109      progress.Status = "Pausing task. Please be patient for the command to take effect.";
    103110      progress.ProgressState = ProgressState.Started;
    104       using (var view = new ProgressView(this, progress)) {
    105         Content.Pause();
    106       }
     111      Content.Pause();
    107112    }
    108113
     
    110115      progress.Status = "Stopping task. Please be patient for the command to take effect.";
    111116      progress.ProgressState = ProgressState.Started;
    112       using (var view = new ProgressView(this, progress)) {
    113         Content.Stop();
    114       }
     117      Content.Stop();
    115118    }
    116119
     
    118121      progress.Status = "Resuming task. Please be patient for the command to take effect.";
    119122      progress.ProgressState = ProgressState.Started;
    120       using (var view = new ProgressView(this, progress)) {
    121         Content.Restart();
    122       }
     123      Content.Restart();
    123124    }
    124125
  • trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBExperimentUploadView.cs

    r8165 r8181  
    5454    Algorithm selectedAlgorithm = null;
    5555    Problem selectedProblem = null;
    56     private ProgressView progressView; // this has to be disposed manually!
     56    private ProgressView progressView;
    5757    private Progress progress;
    5858
     
    223223      progress.Status = "Uploading runs to OKB...";
    224224      progress.ProgressValue = 0;
     225      progress.ProgressState = ProgressState.Started;
    225226      double count = dataGridView.Rows.Count;
    226227      int i = 0;
    227 
    228       using (var view = new ProgressView(this, progress)) {
    229         foreach (DataGridViewRow row in dataGridView.Rows) {
    230           selectedAlgorithm = algorithms.Where(x => x.Name == row.Cells[algorithmColumnIndex].Value.ToString()).FirstOrDefault();
    231           selectedProblem = problems.Where(x => x.Name == row.Cells[problemColumnIndex].Value.ToString()).FirstOrDefault();
    232           if (selectedAlgorithm == null || selectedProblem == null) {
    233             throw new ArgumentException("Can't retrieve the algorithm/problem to upload");
    234           }
    235 
    236           OKBRun run = new OKBRun(selectedAlgorithm.Id, selectedProblem.Id, row.Tag as IRun, UserInformation.Instance.User.Id);
    237           run.Store();
    238           i++;
    239           progress.ProgressValue = ((double)i) / count;
    240         }
     228      foreach (DataGridViewRow row in dataGridView.Rows) {
     229        selectedAlgorithm = algorithms.Where(x => x.Name == row.Cells[algorithmColumnIndex].Value.ToString()).FirstOrDefault();
     230        selectedProblem = problems.Where(x => x.Name == row.Cells[problemColumnIndex].Value.ToString()).FirstOrDefault();
     231        if (selectedAlgorithm == null || selectedProblem == null) {
     232          throw new ArgumentException("Can't retrieve the algorithm/problem to upload");
     233        }
     234
     235        OKBRun run = new OKBRun(selectedAlgorithm.Id, selectedProblem.Id, row.Tag as IRun, UserInformation.Instance.User.Id);
     236        run.Store();
     237        i++;
     238        progress.ProgressValue = ((double)i) / count;
    241239      }
    242240      ClearRuns();
Note: See TracChangeset for help on using the changeset viewer.