Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/28/12 12:00:51 (12 years ago)
Author:
ascheibe
Message:

#1762 implemented review comments:

  • removed self disposing. The progress view now reacts if a progress is set and Finish() is now called on the progress object and not the view.
  • Moved Cancel event from ProgressView to Progress
  • throw ArgumentNullException if the parent view is null
File:
1 edited

Legend:

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

    r7582 r8145  
    3232  public partial class OptimizerHiveTaskView : HiveTaskView {
    3333    private ProgressView progressView;
     34    private IProgress progress;
    3435
    3536    public new OptimizerHiveTask Content {
     
    4445    public OptimizerHiveTaskView() {
    4546      InitializeComponent();
     47      progressView = new ProgressView(this);
    4648    }
    4749
     
    9799
    98100    private void PauseTaskAsync() {
    99       IProgress prog = new Progress();
    100       prog.Status = "Pausing task. Please be patient for the command to take effect.";
    101       SetProgressView(prog);
     101      progress = new Progress();
     102      progress.Status = "Pausing task. Please be patient for the command to take effect.";
     103      SetProgressView(progress);
    102104      Content.Pause();
    103105      FinishProgressView();
     
    105107
    106108    private void StopTaskAsync() {
    107       IProgress prog = new Progress();
    108       prog.Status = "Stopping task. Please be patient for the command to take effect.";
    109       SetProgressView(prog);
     109      progress = new Progress();
     110      progress.Status = "Stopping task. Please be patient for the command to take effect.";
     111      SetProgressView(progress);
    110112      Content.Stop();
    111113      FinishProgressView();
     
    113115
    114116    private void ResumeTaskAsync() {
    115       IProgress prog = new Progress();
    116       prog.Status = "Resuming task. Please be patient for the command to take effect.";
    117       SetProgressView(prog);
     117      progress = new Progress();
     118      progress.Status = "Resuming task. Please be patient for the command to take effect.";
     119      SetProgressView(progress);
    118120      Content.Restart();
    119121      FinishProgressView();
     
    124126        Invoke(new Action<IProgress>(SetProgressView), progress);
    125127      } else {
    126         if (progressView == null) {
    127           progressView = new ProgressView(this, progress);
    128         } else {
    129           progressView.Progress = progress;
    130         }
     128        progressView.Progress = progress;
    131129      }
    132130    }
     
    136134        Invoke(new Action(FinishProgressView));
    137135      } else {
    138         if (progressView != null) {
    139           progressView.Finish();
    140           progressView = null;
    141           SetEnabledStateOfControls();
    142         }
     136        progress.Finish();
     137        SetEnabledStateOfControls();
    143138      }
    144139    }
Note: See TracChangeset for help on using the changeset viewer.