Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/04/11 01:29:43 (13 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.

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r5237 r5419  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Linq;
    2425using System.Windows.Forms;
    2526using HeuristicLab.Common;
     
    133134
    134135    protected override void OnClosed(FormClosedEventArgs e) {
    135       if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop();
     136      if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) {
     137        //The content must be stopped if no other view showing the content is available
     138        var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>();
     139        //add nested optimizers
     140        optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers);
     141
     142        if (!optimizers.Contains(Content)) Content.Stop();
     143      }
    136144      base.OnClosed(e);
    137145    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs

    r5300 r5419  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Windows.Forms;
    2425using HeuristicLab.Common;
     
    109110
    110111    protected override void OnClosed(FormClosedEventArgs e) {
    111       if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop();
     112      if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) {
     113        //The content must be stopped if no other view showing the content is available
     114        var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>();
     115        //add nested optimizers
     116        optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers);
     117
     118        if (!optimizers.Contains(Content)) Content.Stop();
     119      }
    112120      base.OnClosed(e);
    113121    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentView.cs

    r4540 r5419  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Windows.Forms;
    2425using HeuristicLab.Common;
     
    9192
    9293    protected override void OnClosed(FormClosedEventArgs e) {
    93       if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop();
     94      if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) {
     95        //The content must be stopped if no other view showing the content is available
     96        var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>();
     97        //add nested optimizers
     98        optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers);
     99
     100        if (!optimizers.Contains(Content)) Content.Stop();
     101      }
    94102      base.OnClosed(e);
    95103    }
Note: See TracChangeset for help on using the changeset viewer.