Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/27/12 13:31:44 (13 years ago)
Author:
sforsten
Message:

#1784:

  • minor bug fixes in several views
Location:
branches/ProblemInstancesRegressionAndClassification
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemInstancesRegressionAndClassification

    • Property svn:ignore
      •  

        old new  
        33protoc.exe
        44ProtoGen.exe
         5bin
  • branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Optimization.Views/3.3/ProblemView.cs

    r7664 r7665  
    2020#endregion
    2121
     22using System.Linq;
    2223using System.Windows.Forms;
    2324using HeuristicLab.Core.Views;
     
    4647    protected override void OnContentChanged() {
    4748      base.OnContentChanged();
    48       //Check if IProblem implements IProblemInstancesConsumer interface
    49       problemInstanceConsumerView.Content = (IProblemInstanceConsumer)Content;
    50       problemInstanceSplitContainer.Panel1Collapsed = !problemInstanceConsumerView.ContainsProviders();
     49      if (Content != null && CheckForIProblemInstanceConsumer(Content)) {
     50        problemInstanceConsumerView.Content = (IProblemInstanceConsumer)Content;
     51        problemInstanceSplitContainer.Panel1Collapsed = !problemInstanceConsumerView.ContainsProviders();
     52      } else {
     53        problemInstanceSplitContainer.Panel1Collapsed = true;
     54      }
    5155      SetEnabledStateOfControls();
    5256    }
    5357
    54     protected override void SetEnabledStateOfControls() {
    55       base.SetEnabledStateOfControls();
     58    protected bool CheckForIProblemInstanceConsumer(IProblem Content) {
     59      return Content.GetType().GetInterfaces().Any(x => x.IsInterface && x.Equals(typeof(IProblemInstanceConsumer)));
    5660    }
    5761  }
Note: See TracChangeset for help on using the changeset viewer.