Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/04/11 01:29:43 (14 years ago)
Author:
mkommend
Message:

#1402 - Implemented IOptmizer.NestedOptimizers and adapted optimizer views to stop their content only if no way to display the content is available.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.3/CrossValidationView.cs

    r4569 r5419  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Windows.Forms;
    2425using HeuristicLab.Common;
     
    102103    }
    103104
     105    protected override void OnClosed(FormClosedEventArgs e) {
     106      if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) {
     107        //The content must be stopped if no other view showing the content is available
     108        var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>();
     109        //add nested optimizers
     110        optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers);
     111
     112        if (!optimizers.Contains(Content)) Content.Stop();
     113      }
     114      base.OnClosed(e);
     115    }
     116
    104117    protected override void SetEnabledStateOfControls() {
    105118      if (InvokeRequired) Invoke((Action)SetEnabledStateOfControls);
Note: See TracChangeset for help on using the changeset viewer.