Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11214 for trunk/sources


Ignore:
Timestamp:
07/22/14 11:14:31 (10 years ago)
Author:
mkommend
Message:

#2214: Improved and corrected view lookup in the data preprocessing starter.

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessorStarter.cs

    r11171 r11214  
    2121
    2222using System.Windows.Forms;
    23 using HeuristicLab.Core;
    24 using HeuristicLab.Core.Views;
    2523using HeuristicLab.MainForm;
    2624using HeuristicLab.Optimization;
    2725using HeuristicLab.Problems.DataAnalysis;
    2826using HeuristicLab.Problems.DataAnalysis.Views;
    29 using View = HeuristicLab.MainForm.WindowsForms.View;
    3027
    3128namespace HeuristicLab.DataPreprocessing.Views {
    3229  public class DataPreprocessorStarter : IDataPreprocessorStarter {
    3330
    34     public void Start(IDataAnalysisProblemData problemData, View currentView) {
     31    public void Start(IDataAnalysisProblemData problemData, IContentView currentView) {
    3532      IAlgorithm algorithm;
    3633      IDataAnalysisProblem problem;
    37       IItem parentItem = GetMostOuterContent(currentView, out algorithm, out problem);
     34      GetMostOuterContent(currentView as Control, out algorithm, out problem);
    3835      var context = new PreprocessingContext(problemData, algorithm, problem);
    3936      MainFormManager.MainForm.ShowContent(context);
    4037    }
    4138
    42     private IItem GetMostOuterContent(Control control, out IAlgorithm algorithm, out IDataAnalysisProblem problem) {
     39    private void GetMostOuterContent(Control control, out IAlgorithm algorithm, out IDataAnalysisProblem problem) {
    4340      algorithm = null;
    4441      problem = null;
    45       ItemView itemView = null;
    46       do {
     42
     43      while (control != null) {
     44        IContentView contentView = control as IContentView;
     45        if (contentView != null) {
     46          algorithm = contentView.Content as IAlgorithm;
     47          problem = contentView.Content as IDataAnalysisProblem;
     48        }
    4749        control = control.Parent;
    48         if (control is ItemView) {
    49           itemView = (ItemView)control;
    50           if (itemView.Content is IAlgorithm) {
    51             algorithm = (IAlgorithm)itemView.Content;
    52           }
    53           if (itemView.Content is IDataAnalysisProblem) {
    54             problem = (IDataAnalysisProblem)itemView.Content;
    55           }
    56         }
    57       } while (control != null);
    58 
    59       return itemView.Content;
     50      }
    6051    }
    6152  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Interfaces/IDataPreprocessorStarter.cs

    r11171 r11214  
    2020#endregion
    2121
    22 using HeuristicLab.MainForm.WindowsForms;
     22using HeuristicLab.MainForm;
    2323
    2424namespace HeuristicLab.Problems.DataAnalysis.Views {
    2525  public interface IDataPreprocessorStarter {
    26     void Start(IDataAnalysisProblemData problemData, View currentView);
     26    void Start(IDataAnalysisProblemData problemData, IContentView currentView);
    2727  }
    2828}
Note: See TracChangeset for help on using the changeset viewer.