Changeset 11748


Ignore:
Timestamp:
01/13/15 13:15:03 (5 years ago)
Author:
ascheibe
Message:

#2158 merged r11555,r11557,r11592,r11736 into stable

Location:
stable
Files:
3 edited
2 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj

    r8600 r11748  
    147147      <DependentUpon>LogView.cs</DependentUpon>
    148148    </Compile>
     149    <Compile Include="NestingLevelErrorControl.cs">
     150      <SubType>UserControl</SubType>
     151    </Compile>
     152    <Compile Include="NestingLevelErrorControl.Designer.cs">
     153      <DependentUpon>NestingLevelErrorControl.cs</DependentUpon>
     154    </Compile>
    149155    <Compile Include="Plugin.cs" />
    150156    <Compile Include="VariableValueView.cs">
     
    378384  -->
    379385  <PropertyGroup>
    380    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     386    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    381387set ProjectDir=$(ProjectDir)
    382388set SolutionDir=$(SolutionDir)
     
    385391call PreBuildEvent.cmd
    386392</PreBuildEvent>
    387 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     393    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
    388394export ProjectDir=$(ProjectDir)
    389395export SolutionDir=$(SolutionDir)
  • stable/HeuristicLab.Core.Views/3.3/ItemView.cs

    r11170 r11748  
    2020#endregion
    2121
     22using System;
     23using System.Windows.Forms;
    2224using HeuristicLab.MainForm.WindowsForms;
    2325
     
    2729  /// </summary>
    2830  public partial class ItemView : AsynchronousContentView {
     31    public const int MaximumNestingLevel = 35;
     32
    2933    public new IItem Content {
    3034      get { return (IItem)base.Content; }
     
    3842      InitializeComponent();
    3943    }
     44
     45    protected override void OnInitialized(EventArgs e) {
     46      base.OnInitialized(e);
     47
     48      if (CountParentControls() > MaximumNestingLevel) {
     49        //capture content, needed because it is set at a later time
     50        NestingLevelErrorControl errorControl = new NestingLevelErrorControl(() => Content, this.GetType());
     51        errorControl.Dock = DockStyle.Fill;
     52
     53        Controls.Clear();
     54        Controls.Add(errorControl);
     55      }
     56    }
     57
     58    private int CountParentControls() {
     59      int cnt = 0;
     60      Control parent = Parent;
     61      while (parent != null) {
     62        parent = parent.Parent;
     63        cnt++;
     64      }
     65      return cnt;
     66    }
    4067  }
    4168}
  • stable/HeuristicLab.Core.Views/3.3/NestingLevelErrorControl.Designer.cs

    r11555 r11748  
    6161      // showButton
    6262      //
    63       this.showButton.Location = new System.Drawing.Point(3, 19);
     63      this.showButton.Location = new System.Drawing.Point(7, 21);
    6464      this.showButton.Name = "showButton";
    6565      this.showButton.Size = new System.Drawing.Size(132, 23);
     
    7575      this.Controls.Add(this.infoLabel);
    7676      this.Name = "NestingLevelErrorControl";
    77       this.Size = new System.Drawing.Size(387, 46);
     77      this.Size = new System.Drawing.Size(387, 50);
    7878      this.ResumeLayout(false);
    7979      this.PerformLayout();
  • stable/HeuristicLab.Core.Views/3.3/NestingLevelErrorControl.cs

    r11555 r11748  
    2727namespace HeuristicLab.Core.Views {
    2828  public partial class NestingLevelErrorControl : UserControl {
    29     public Func<IContent> Content { get; set; }
     29    private Func<IContent> Content { get; set; }
     30    private Type ViewType { get; set; }
    3031
    31     public NestingLevelErrorControl() {
     32    public NestingLevelErrorControl(Func<IContent> content, Type viewType)
     33      : base() {
    3234      InitializeComponent();
     35      Content = content;
     36      ViewType = viewType;
    3337    }
    3438
    3539    private void showButton_Click(object sender, System.EventArgs e) {
    36       if (Content != null) {
    37         if (MainFormManager.MainForm.ShowContent(Content()) == null) {
    38           using (TypeSelectorDialog dialog = new TypeSelectorDialog()) {
    39             dialog.Caption = "Unable to find view for content. Please choose a appropriate view.";
    40             dialog.TypeSelector.Configure(typeof(IContentView), false, false);
    41 
    42             if (dialog.ShowDialog(this) == DialogResult.OK) {
    43               MainFormManager.MainForm.ShowContent(Content(), dialog.TypeSelector.SelectedType);
    44             }
    45           }
    46         }
     40      if (Content != null && ViewType != null) {
     41        MainFormManager.MainForm.ShowContent(Content(), ViewType);
    4742      }
    4843    }
Note: See TracChangeset for help on using the changeset viewer.