Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7347


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
Location:
branches/ChangeDatasetOfRegressionModel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ChangeDatasetOfRegressionModel/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r7259 r7347  
    6464        if (components != null) components.Dispose();
    6565      }
     66      DeregisterContentEvents();
    6667      base.Dispose(disposing);
    6768    }
     
    9394    protected override void OnContentChanged() {
    9495      base.OnContentChanged();
     96      foreach (T item in itemListViewItemMapping.Keys) {
     97        DeregisterItemEvents(item);
     98      }
    9599      itemsListView.Items.Clear();
    96100      itemListViewItemMapping.Clear();
     
    190194      T item = listViewItem.Tag as T;
    191195      int i = listViewItem.ImageIndex;
    192       itemsListView.SmallImageList.Images[i] = item == null ? HeuristicLab.Common.Resources.VSImageLibrary.Nothing : item.ItemImage;
     196      if (itemsListView.SmallImageList != null) {
     197        itemsListView.SmallImageList.Images[i] = item == null ? HeuristicLab.Common.Resources.VSImageLibrary.Nothing : item.ItemImage;
     198      } else {
     199        listViewItem.ImageIndex = -1;
     200      }
    193201      listViewItem.ImageIndex = -1;
    194202      listViewItem.ImageIndex = i;
  • 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.