Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2998


Ignore:
Timestamp:
03/11/10 02:48:42 (15 years ago)
Author:
swagner
Message:

Fixed disabling of controls in algorithm views when the algorithm is executed (#905)

Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.SGA.Views/3.3/SGAView.cs

    r2917 r2998  
    4949      Content = content;
    5050    }
    51 
    52     protected override void DeregisterContentEvents() {
    53       // deregister events here
    54       base.DeregisterContentEvents();
    55     }
    56     protected override void RegisterContentEvents() {
    57       base.RegisterContentEvents();
    58       // register events here
    59     }
    60 
    61     protected override void OnContentChanged() {
    62       base.OnContentChanged();
    63       if (Content == null) {
    64       } else {
    65       }
    66     }
    6751  }
    6852}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r2961 r2998  
    127127        Invoke(new EventHandler(Content_Prepared), sender, e);
    128128      else {
    129         parameterCollectionView.Enabled = true;
    130         newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = true;
    131         problemViewHost.Enabled = true;
    132129        resultsView.Content = Content.Results;
    133         resultsView.Enabled = true;
    134130        startButton.Enabled = !Content.Finished;
    135         stopButton.Enabled = false;
    136         resetButton.Enabled = true;
    137         UpdateExecutionTimeTextBox();
    138       }
    139     }
    140     protected void Content_ProblemChanged(object sender, EventArgs e) {
     131        UpdateExecutionTimeTextBox();
     132      }
     133    }
     134    protected virtual void Content_ProblemChanged(object sender, EventArgs e) {
    141135      if (InvokeRequired)
    142136        Invoke(new EventHandler(Content_ProblemChanged), sender, e);
     
    194188
    195189    #region Button events
    196     protected void newProblemButton_Click(object sender, EventArgs e) {
     190    protected virtual void newProblemButton_Click(object sender, EventArgs e) {
    197191      if (problemTypeSelectorDialog == null) {
    198192        problemTypeSelectorDialog = new TypeSelectorDialog();
     
    204198      }
    205199    }
    206     protected void openProblemButton_Click(object sender, EventArgs e) {
     200    protected virtual void openProblemButton_Click(object sender, EventArgs e) {
    207201      openFileDialog.Title = "Open Problem";
    208202      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
     
    231225      }
    232226    }
    233     protected void saveProblemButton_Click(object sender, EventArgs e) {
     227    protected virtual void saveProblemButton_Click(object sender, EventArgs e) {
    234228      saveFileDialog.Title = "Save Problem";
    235229      if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs

    r2949 r2998  
    8787
    8888      if (Content == null) {
    89         engineComboBox.Enabled = false;
    9089        engineViewHost.Content = null;
    91         engineViewHost.Enabled = false;
     90        createUserDefinedAlgorithmButton.Enabled = false;
    9291      } else {
    93         engineComboBox.Enabled = true;
    9492        if (Content.Engine == null)
    9593          engineComboBox.SelectedIndex = engineTypes.IndexOf(null);
    9694        else
    9795          engineComboBox.SelectedIndex = engineTypes.IndexOf(Content.Engine.GetType());
    98         engineViewHost.Enabled = true;
    9996        engineViewHost.ViewType = null;
    10097        engineViewHost.Content = Content.Engine;
     98        createUserDefinedAlgorithmButton.Enabled = true;
    10199      }
    102100    }
    103101
    104     protected void Content_EngineChanged(object sender, System.EventArgs e) {
     102    protected override void Content_Started(object sender, EventArgs e) {
     103      if (InvokeRequired)
     104        Invoke(new EventHandler(Content_Started), sender, e);
     105      else {
     106        createUserDefinedAlgorithmButton.Enabled = false;
     107        engineComboBox.Enabled = false;
     108        engineViewHost.Enabled = false;
     109        base.Content_Started(sender, e);
     110      }
     111    }
     112    protected override void Content_Stopped(object sender, EventArgs e) {
     113      if (InvokeRequired)
     114        Invoke(new EventHandler(Content_Stopped), sender, e);
     115      else {
     116        createUserDefinedAlgorithmButton.Enabled = true;
     117        engineComboBox.Enabled = true;
     118        engineViewHost.Enabled = true;
     119        base.Content_Stopped(sender, e);
     120      }
     121    }
     122    protected virtual void Content_EngineChanged(object sender, System.EventArgs e) {
    105123      if (InvokeRequired)
    106124        Invoke(new EventHandler(Content_EngineChanged), sender, e);
     
    115133    }
    116134
    117     protected void engineComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     135    protected virtual void engineComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    118136      if (Content != null) {
    119137        Type t = engineTypes[engineComboBox.SelectedIndex];
     
    125143    }
    126144
    127     protected void createUserDefinedAlgorithmButton_Click(object sender, EventArgs e) {
     145    protected virtual void createUserDefinedAlgorithmButton_Click(object sender, EventArgs e) {
    128146      MainFormManager.CreateDefaultView(Content.CreateUserDefinedAlgorithm()).Show();
    129147    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.cs

    r2954 r2998  
    7575    }
    7676
     77    protected override void Content_Started(object sender, EventArgs e) {
     78      if (InvokeRequired)
     79        Invoke(new EventHandler(Content_Started), sender, e);
     80      else {
     81        newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false;
     82        operatorGraphViewHost.Enabled = false;
     83        globalScopeView.Enabled = false;
     84        base.Content_Started(sender, e);
     85      }
     86    }
     87    protected override void Content_Stopped(object sender, EventArgs e) {
     88      if (InvokeRequired)
     89        Invoke(new EventHandler(Content_Stopped), sender, e);
     90      else {
     91        newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = true;
     92        operatorGraphViewHost.Enabled = true;
     93        globalScopeView.Enabled = true;
     94        base.Content_Stopped(sender, e);
     95      }
     96    }
    7797    private void Content_OperatorGraphChanged(object sender, EventArgs e) {
    7898      if (InvokeRequired)
  • trunk/sources/HeuristicLab.Problems.TSP.Views/3.3/TSPView.cs

    r2917 r2998  
    5353    }
    5454
     55    protected override void OnContentChanged() {
     56      base.OnContentChanged();
     57      if (Content == null) {
     58        importButton.Enabled = false;
     59      } else {
     60        importButton.Enabled = true;
     61      }
     62    }
     63
    5564    private void importButton_Click(object sender, System.EventArgs e) {
    5665      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
Note: See TracChangeset for help on using the changeset viewer.