Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 04:27:50 (14 years ago)
Author:
swagner
Message:

Fixed bugs when quickly stopping, resetting and restarting algorithms (#1027)

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r4068 r4070  
    7070      Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
    7171      Content.Prepared -= new EventHandler(Content_Prepared);
     72      Content.Started -= new EventHandler(Content_Started);
     73      Content.Paused -= new EventHandler(Content_Paused);
     74      Content.Stopped -= new EventHandler(Content_Stopped);
    7275      Content.ProblemChanged -= new EventHandler(Content_ProblemChanged);
    7376      base.DeregisterContentEvents();
     
    7982      Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);
    8083      Content.Prepared += new EventHandler(Content_Prepared);
     84      Content.Started += new EventHandler(Content_Started);
     85      Content.Paused += new EventHandler(Content_Paused);
     86      Content.Stopped += new EventHandler(Content_Stopped);
    8187      Content.ProblemChanged += new EventHandler(Content_ProblemChanged);
    8288    }
     
    126132      }
    127133    }
     134    protected virtual void Content_ExecutionStateChanged(object sender, EventArgs e) {
     135      if (InvokeRequired)
     136        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
     137      else
     138        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
     139    }
    128140    protected virtual void Content_Prepared(object sender, EventArgs e) {
    129141      if (InvokeRequired)
    130142        Invoke(new EventHandler(Content_Prepared), sender, e);
    131       else
     143      else {
    132144        resultsView.Content = Content.Results.AsReadOnly();
    133     }
    134     protected virtual void Content_ExecutionStateChanged(object sender, EventArgs e) {
    135       if (InvokeRequired)
    136         Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    137       else {
    138         ReadOnly = Content.ExecutionState == ExecutionState.Started;
    139         Locked = Content.ExecutionState == ExecutionState.Started;
     145        ReadOnly = Locked = false;
     146        SetEnabledStateOfExecutableButtons();
     147      }
     148    }
     149    protected virtual void Content_Started(object sender, EventArgs e) {
     150      if (InvokeRequired)
     151        Invoke(new EventHandler(Content_Started), sender, e);
     152      else {
     153        ReadOnly = Locked = true;
     154        SetEnabledStateOfExecutableButtons();
     155      }
     156    }
     157    protected virtual void Content_Paused(object sender, EventArgs e) {
     158      if (InvokeRequired)
     159        Invoke(new EventHandler(Content_Paused), sender, e);
     160      else {
     161        ReadOnly = Locked = false;
     162        SetEnabledStateOfExecutableButtons();
     163      }
     164    }
     165    protected virtual void Content_Stopped(object sender, EventArgs e) {
     166      if (InvokeRequired)
     167        Invoke(new EventHandler(Content_Stopped), sender, e);
     168      else {
     169        ReadOnly = Locked = false;
    140170        SetEnabledStateOfExecutableButtons();
    141171      }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs

    r4068 r4070  
    5454      Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
    5555      Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
     56      Content.Prepared -= new EventHandler(Content_Prepared);
     57      Content.Started -= new EventHandler(Content_Started);
     58      Content.Paused -= new EventHandler(Content_Paused);
     59      Content.Stopped -= new EventHandler(Content_Stopped);
    5660      Content.RepetitionsChanged -= new EventHandler(Content_RepetitionsChanged);
    5761      base.DeregisterContentEvents();
     
    6367      Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
    6468      Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);
     69      Content.Prepared += new EventHandler(Content_Prepared);
     70      Content.Started += new EventHandler(Content_Started);
     71      Content.Paused += new EventHandler(Content_Paused);
     72      Content.Stopped += new EventHandler(Content_Stopped);
    6573      Content.RepetitionsChanged += new EventHandler(Content_RepetitionsChanged);
    6674    }
     
    100108      if (InvokeRequired)
    101109        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    102       else {
    103         this.ReadOnly = Content.ExecutionState == ExecutionState.Started;
    104         Locked = Content.ExecutionState == ExecutionState.Started;
     110      else
     111        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
     112    }
     113    private void Content_Prepared(object sender, EventArgs e) {
     114      if (InvokeRequired)
     115        Invoke(new EventHandler(Content_Prepared), sender, e);
     116      else {
     117        ReadOnly = Locked = false;
     118        SetEnabledStateOfExecutableButtons();
     119      }
     120    }
     121    private void Content_Started(object sender, EventArgs e) {
     122      if (InvokeRequired)
     123        Invoke(new EventHandler(Content_Started), sender, e);
     124      else {
     125        ReadOnly = Locked = true;
     126        SetEnabledStateOfExecutableButtons();
     127      }
     128    }
     129    private void Content_Paused(object sender, EventArgs e) {
     130      if (InvokeRequired)
     131        Invoke(new EventHandler(Content_Paused), sender, e);
     132      else {
     133        ReadOnly = Locked = false;
     134        SetEnabledStateOfExecutableButtons();
     135      }
     136    }
     137    private void Content_Stopped(object sender, EventArgs e) {
     138      if (InvokeRequired)
     139        Invoke(new EventHandler(Content_Stopped), sender, e);
     140      else {
     141        ReadOnly = Locked = false;
    105142        SetEnabledStateOfExecutableButtons();
    106143      }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentView.cs

    r3904 r4070  
    5151      Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
    5252      Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);
     53      Content.Prepared -= new EventHandler(Content_Prepared);
     54      Content.Started -= new EventHandler(Content_Started);
     55      Content.Paused -= new EventHandler(Content_Paused);
     56      Content.Stopped -= new EventHandler(Content_Stopped);
    5357      base.DeregisterContentEvents();
    5458    }
     
    5862      Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
    5963      Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);
     64      Content.Prepared += new EventHandler(Content_Prepared);
     65      Content.Started += new EventHandler(Content_Started);
     66      Content.Paused += new EventHandler(Content_Paused);
     67      Content.Stopped += new EventHandler(Content_Stopped);
    6068    }
    6169
     
    9098      if (InvokeRequired)
    9199        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
     100      else
     101        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false;
     102    }
     103    private void Content_Prepared(object sender, EventArgs e) {
     104      if (InvokeRequired)
     105        Invoke(new EventHandler(Content_Prepared), sender, e);
    92106      else {
    93         nameTextBox.Enabled = Content.ExecutionState != ExecutionState.Started;
    94         descriptionTextBox.Enabled = Content.ExecutionState != ExecutionState.Started;
    95         Locked = Content.ExecutionState == ExecutionState.Started;
     107        nameTextBox.Enabled = descriptionTextBox.Enabled = true;
     108        Locked = false;
     109        SetEnabledStateOfExecutableButtons();
     110      }
     111    }
     112    private void Content_Started(object sender, EventArgs e) {
     113      if (InvokeRequired)
     114        Invoke(new EventHandler(Content_Started), sender, e);
     115      else {
     116        nameTextBox.Enabled = descriptionTextBox.Enabled = false;
     117        Locked = true;
     118        SetEnabledStateOfExecutableButtons();
     119      }
     120    }
     121    private void Content_Paused(object sender, EventArgs e) {
     122      if (InvokeRequired)
     123        Invoke(new EventHandler(Content_Paused), sender, e);
     124      else {
     125        nameTextBox.Enabled = descriptionTextBox.Enabled = true;
     126        Locked = false;
     127        SetEnabledStateOfExecutableButtons();
     128      }
     129    }
     130    private void Content_Stopped(object sender, EventArgs e) {
     131      if (InvokeRequired)
     132        Invoke(new EventHandler(Content_Stopped), sender, e);
     133      else {
     134        nameTextBox.Enabled = descriptionTextBox.Enabled = true;
     135        Locked = false;
    96136        SetEnabledStateOfExecutableButtons();
    97137      }
Note: See TracChangeset for help on using the changeset viewer.