Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/17/12 16:18:18 (13 years ago)
Author:
sforsten
Message:

#1758:

  • Bug fix in ItemCollectionView: Content events are deregistered in Dispose method
  • Bug fix in ItemCollectionView: Item events are deregistered in OnContentChanged method
  • small changes in RegressionSolutionView
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs

    r7338 r7347  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Linq;
     25using System.Text;
    2426using System.Windows.Forms;
    2527using HeuristicLab.Core;
     
    6466          ErrorHandling.ShowErrorDialog(this, ex);
    6567        }
     68
    6669        IRegressionProblemData problemData = null;
    6770        if (hlFile != null && hlFile is RegressionProblemData) {
     
    7174        }
    7275        if (problemData != null) {
    73           IList<string> missingVariables = new List<string>();
     76          StringBuilder message = new StringBuilder();
    7477          if (!problemData.TargetVariable.Equals(Content.ProblemData.TargetVariable))
    75             missingVariables.Add(Content.ProblemData.TargetVariable);
     78            message.AppendLine("The target variables are not matching. Old target variable: '" + Content.ProblemData.TargetVariable
     79              + "'. New targetvariable: '" + problemData.TargetVariable + "'");
    7680
    77           //foreach (var item in Content.ProblemData.InputVariables.CheckedItems) {
    78           //  if (!problemData.InputVariables.Contains(item.Value))
    79           //    missingVariables.Add(item.Value.ToString());
    80           //}
     81          List<string> variables = problemData.InputVariables.Select(x => x.Value).ToList();
    8182
    82           //easier solution will be created later
    83           bool found;
    8483          foreach (var item in Content.ProblemData.InputVariables.CheckedItems) {
    85             found = false;
    86             foreach (var it in problemData.InputVariables) {
    87               if (it.Value.Equals(item.Value.Value)) {
    88                 found = true;
    89                 break;
    90               }
    91             }
    92             if (!found)
    93               missingVariables.Add(item.Value.ToString());
     84            if (!variables.Contains(item.Value.Value))
     85              message.AppendLine("Input variable '" + item.Value.Value + "' is not in the new problem data.");
    9486          }
    9587
    96           if (missingVariables.Count != 0) {
    97             string message = "";
    98             foreach (var item in missingVariables) {
    99               message += item + Environment.NewLine;
    100             }
    101             ErrorHandling.ShowErrorDialog(this, new Exception(message));
    102           } else {
     88          if (message.Length != 0)
     89            ErrorHandling.ShowErrorDialog(this, new Exception(message.ToString()));
     90          else
    10391            Content.ProblemData = problemData;
    104           }
    10592        }
    10693      }
Note: See TracChangeset for help on using the changeset viewer.