Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/26/17 09:45:36 (7 years ago)
Author:
jkarder
Message:

#2258: refactored async methods

  • synchronously called IExecutables are now executed in the caller's thread
  • removed old synchronization code from unit tests
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Async/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/Script Sources/GUIAutomationScriptSource.cs

    r11789 r15065  
    1 using System;
    2 using System.Linq;
    3 using System.Threading;
     1using System.Linq;
    42using System.Windows.Forms;
    53
    64using HeuristicLab.Algorithms.GeneticAlgorithm;
    7 using HeuristicLab.Core;
    85using HeuristicLab.MainForm;
    96using HeuristicLab.MainForm.WindowsForms;
     
    1310
    1411public class GUIAutomationScript : HeuristicLab.Scripting.CSharpScriptBase {
    15   readonly ManualResetEvent mutex = new ManualResetEvent(false);
    16 
    1712  public override void Main() {
    1813    var ga = new GeneticAlgorithm {
     
    2722      ga.PopulationSize.Value *= 2;
    2823    }
    29 
    30     experiment.ExecutionStateChanged += OnExecutionStateChanged;
    3124    experiment.Start();
    32     mutex.WaitOne();
    3325
    3426    vars.experiment = experiment;
     
    3931    bubbleChart.Controls.OfType<ComboBox>().Single(x => x.Name == "xAxisComboBox").SelectedItem = "PopulationSize";
    4032  }
    41 
    42   private void OnExecutionStateChanged(object sender, EventArgs e) {
    43     if (((IExecutable)sender).ExecutionState == ExecutionState.Stopped)
    44       mutex.Set();
    45   }
    4633}
Note: See TracChangeset for help on using the changeset viewer.