Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/05/11 09:45:20 (14 years ago)
Author:
epitzer
Message:

Use a background worker to execute single steps to prevent the GUI locking up for long-running operations (#47)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DebugEngine/3.3/DebugEngineView.cs

    r5114 r5222  
    2525using HeuristicLab.Core.Views;
    2626using HeuristicLab.MainForm;
     27using System.ComponentModel;
    2728namespace HeuristicLab.DebugEngine {
    2829
     
    124125    private bool stepping = false;
    125126    private void stepButton_Click(object sender, EventArgs e) {
     127      BackgroundWorker worker = new BackgroundWorker();
     128      bool skipStackops = skipStackOpsCheckBox.Checked;
     129      worker.DoWork += (s, a) => {
     130        Content.Step(skipStackops);
     131      };
     132      worker.RunWorkerCompleted += (s, a) => {
     133        stepping = false;
     134        SetEnabledStateOfControls();
     135      };
    126136      stepping = true;
    127       Content.Step(skipStackOpsCheckBox.Checked);
    128       stepping = false;
     137      stepButton.Enabled = false;
     138      worker.RunWorkerAsync();
    129139    }
    130140
Note: See TracChangeset for help on using the changeset viewer.