Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/27/19 10:14:28 (5 years ago)
Author:
fholzing
Message:

#2973: Changed cancelation-initiation from VisibleChanged to OnHidden and added a flag, preventing an error in case the View gets closed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs

    r17180 r17276  
    4040    private CancellationTokenSource cancellationToken = new CancellationTokenSource();
    4141    private List<Tuple<string, double>> rawVariableImpacts = new List<Tuple<string, double>>();
     42    private bool attachedToProgress = false;
    4243
    4344    public new IClassificationSolution Content {
     
    8687      }
    8788    }
    88     private void ClassificationSolutionVariableImpactsView_VisibleChanged(object sender, EventArgs e) {
     89    protected override void OnHidden(EventArgs e) {
     90      base.OnHidden(e);
    8991      cancellationToken.Cancel();
     92
     93      if (attachedToProgress) {
     94        Progress.Hide(this);
     95        attachedToProgress = false;
     96      }
    9097    }
    9198
     
    126133      variableImpactsArrayView.Caption = Content.Name + " Variable Impacts";
    127134      progress = Progress.Show(this, "Calculating variable impacts for " + Content.Name);
     135      attachedToProgress = true;
    128136      cancellationToken = new CancellationTokenSource();
    129137
     
    144152        UpdateOrdering();
    145153      } finally {
    146         Progress.Hide(this);
     154        if (attachedToProgress) {
     155          Progress.Hide(this);
     156          attachedToProgress = false;
     157        }
    147158      }
    148159    }
Note: See TracChangeset for help on using the changeset viewer.