Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/23/12 17:14:54 (12 years ago)
Author:
sforsten
Message:

#1758:

  • implemented SetEnabledStateOfControls in RegressionSolutionView
  • fixed bug in NamedDataAnalysisSolutionView (If OnContentChanged creates a new DataAnalysisSolutionView, it sets Locked and ReadOnly as it is set in the current view.)
Location:
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views
Files:
2 edited

Legend:

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

    • Property svn:ignore set to
      *.resx
  • branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs

    r7347 r7399  
    4343    }
    4444
     45    protected override void SetEnabledStateOfControls() {
     46      base.SetEnabledStateOfControls();
     47      btnImport.Enabled = !Locked && !ReadOnly && Content != null;
     48    }
     49
    4550    #region drag and drop
    4651    protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
     
    6772        }
    6873
    69         IRegressionProblemData problemData = null;
    70         if (hlFile != null && hlFile is RegressionProblemData) {
    71           problemData = (RegressionProblemData)hlFile;
    72         } else if (hlFile != null && hlFile is IRegressionProblem) {
    73           problemData = ((IRegressionProblem)hlFile).ProblemData;
    74         }
    75         if (problemData != null) {
    76           StringBuilder message = new StringBuilder();
    77           if (!problemData.TargetVariable.Equals(Content.ProblemData.TargetVariable))
    78             message.AppendLine("The target variables are not matching. Old target variable: '" + Content.ProblemData.TargetVariable
    79               + "'. New targetvariable: '" + problemData.TargetVariable + "'");
    80 
    81           List<string> variables = problemData.InputVariables.Select(x => x.Value).ToList();
    82 
    83           foreach (var item in Content.ProblemData.InputVariables.CheckedItems) {
    84             if (!variables.Contains(item.Value.Value))
    85               message.AppendLine("Input variable '" + item.Value.Value + "' is not in the new problem data.");
     74        if (hlFile != null) {
     75          IRegressionProblemData problemData = null;
     76          if (hlFile is RegressionProblemData) {
     77            problemData = (RegressionProblemData)hlFile;
     78          } else if (hlFile is IRegressionProblem) {
     79            problemData = ((IRegressionProblem)hlFile).ProblemData;
     80          } else if (hlFile is IRegressionSolution) {
     81            problemData = ((IRegressionSolution)hlFile).ProblemData;
    8682          }
    8783
    88           if (message.Length != 0)
    89             ErrorHandling.ShowErrorDialog(this, new Exception(message.ToString()));
    90           else
    91             Content.ProblemData = problemData;
     84          if (problemData == null) {
     85            ErrorHandling.ShowErrorDialog(this,
     86              new NullReferenceException("The problem data is null." + Environment.NewLine
     87                                       + "The .hl-file is no RegressionProblemData or RegressionProblem."));
     88          } else {
     89            StringBuilder message = new StringBuilder();
     90            if (!problemData.TargetVariable.Equals(Content.ProblemData.TargetVariable))
     91              message.AppendLine("The target variables are not matching. Old target variable: '"
     92                               + Content.ProblemData.TargetVariable
     93                               + "'. New targetvariable: '" + problemData.TargetVariable + "'");
     94
     95            List<string> variables = problemData.InputVariables.Select(x => x.Value).ToList();
     96
     97            foreach (var item in Content.ProblemData.InputVariables.CheckedItems) {
     98              if (!variables.Contains(item.Value.Value))
     99                message.AppendLine("Input variable '" + item.Value.Value + "' is not in the new problem data.");
     100            }
     101
     102            if (message.Length != 0)
     103              ErrorHandling.ShowErrorDialog(this, new Exception(message.ToString()));
     104            else
     105              Content.ProblemData = problemData;
     106          }
    92107        }
    93108      }
Note: See TracChangeset for help on using the changeset viewer.