Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/03/13 15:55:36 (11 years ago)
Author:
ascheibe
Message:

#1042 merged r9849, r9851, r9865, r9867, r9868, r9893, r9894, r9895, r9896, r9900, r9901, r9905, r9907 into stable branch

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.cs

    r9456 r9933  
    3131  [Content(typeof(OptimizerHiveTask), true)]
    3232  public partial class OptimizerHiveTaskView : HiveTaskView {
    33     private Progress progress;
    34     private ProgressView progressView;
    35 
    3633    public new OptimizerHiveTask Content {
    3734      get { return (OptimizerHiveTask)base.Content; }
     
    4542    public OptimizerHiveTaskView() {
    4643      InitializeComponent();
    47       progress = new Progress() {
    48         CanBeCanceled = false,
    49         ProgressState = ProgressState.Finished
    50       };
    5144    }
    5245
     
    6053      }
    6154    }
     55
    6256    #region Content Events
    6357    protected override void RegisterContentEvents() {
    6458      base.RegisterContentEvents();
    6559      Content.IsControllableChanged += new EventHandler(Content_IsControllableChanged);
    66       progressView = new ProgressView(this, progress);
     60      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, Content.Progress);
    6761    }
    6862
    6963    protected override void DeregisterContentEvents() {
    7064      Content.IsControllableChanged -= new EventHandler(Content_IsControllableChanged);
    71       if (progressView != null) {
    72         progressView.Content = null;
    73         progressView.Dispose();
    74         progressView = null;
    75       }
     65      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false);
    7666      base.DeregisterContentEvents();
    7767    }
     
    8070      SetEnabledStateOfControls();
    8171    }
    82 
    8372    #endregion
    8473
     
    8776      var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeTaskAsync);
    8877      task.ContinueWith((t) => {
    89         progress.Finish();
     78        Content.Progress.Finish();
    9079        ErrorHandling.ShowErrorDialog(this, "An error occured while resuming the task.", t.Exception);
    9180      }, TaskContinuationOptions.OnlyOnFaulted);
     
    9584      var task = System.Threading.Tasks.Task.Factory.StartNew(PauseTaskAsync);
    9685      task.ContinueWith((t) => {
    97         progress.Finish();
     86        Content.Progress.Finish();
    9887        ErrorHandling.ShowErrorDialog(this, "An error occured while pausing the task.", t.Exception);
    9988      }, TaskContinuationOptions.OnlyOnFaulted);
     
    10392      var task = System.Threading.Tasks.Task.Factory.StartNew(StopTaskAsync);
    10493      task.ContinueWith((t) => {
    105         progress.Finish();
     94        Content.Progress.Finish();
    10695        ErrorHandling.ShowErrorDialog(this, "An error occured while stopping the task.", t.Exception);
    10796      }, TaskContinuationOptions.OnlyOnFaulted);
     
    11099
    111100    private void PauseTaskAsync() {
    112       progress.Status = "Pausing task. Please be patient for the command to take effect.";
    113       progress.ProgressState = ProgressState.Started;
     101      Content.Progress.Start("Pausing task. Please be patient for the command to take effect.");
    114102      Content.Pause();
    115       progress.Finish();
     103      Content.Progress.Finish();
    116104    }
    117105
    118106    private void StopTaskAsync() {
    119       progress.Status = "Stopping task. Please be patient for the command to take effect.";
    120       progress.ProgressState = ProgressState.Started;
     107      Content.Progress.Start("Stopping task. Please be patient for the command to take effect.");
    121108      Content.Stop();
    122       progress.Finish();
     109      Content.Progress.Finish();
    123110    }
    124111
    125112    private void ResumeTaskAsync() {
    126       progress.Status = "Resuming task. Please be patient for the command to take effect.";
    127       progress.ProgressState = ProgressState.Started;
     113      Content.Progress.Start("Resuming task. Please be patient for the command to take effect.");
    128114      Content.Restart();
    129       progress.Finish();
     115      Content.Progress.Finish();
    130116    }
    131117
Note: See TracChangeset for help on using the changeset viewer.