Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17568 for trunk


Ignore:
Timestamp:
05/28/20 15:56:23 (4 years ago)
Author:
mkommend
Message:

#3071: Refactored NestingLevelErrorControl and corrected view state forwarding.

Location:
trunk/HeuristicLab.Core.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Core.Views/3.3/ItemView.cs

    r17180 r17568  
    4545
    4646      if (CountParentControls() > Properties.Settings.Default.MaximumNestedControls) {
    47         //capture content, needed because it is set at a later time
    48         NestingLevelErrorControl errorControl = new NestingLevelErrorControl(() => Content, this.GetType());
     47        var errorControl = new NestingLevelErrorControl();
    4948        errorControl.Dock = DockStyle.Fill;
    5049
  • trunk/HeuristicLab.Core.Views/3.3/NestingLevelErrorControl.cs

    r17180 r17568  
    2020#endregion
    2121
    22 using System;
    2322using System.Windows.Forms;
    24 using HeuristicLab.Common;
    2523using HeuristicLab.MainForm;
    2624
    2725namespace HeuristicLab.Core.Views {
    2826  public partial class NestingLevelErrorControl : UserControl {
    29     private Func<IContent> Content { get; set; }
    30     private Type ViewType { get; set; }
    31 
    32     public NestingLevelErrorControl(Func<IContent> content, Type viewType)
    33       : base() {
     27    public NestingLevelErrorControl() : base() {
    3428      InitializeComponent();
    35       Content = content;
    36       ViewType = viewType;
    3729    }
    3830
     31    private IContentView SurroundingView => (IContentView)Parent;
     32
    3933    private void showButton_Click(object sender, System.EventArgs e) {
    40       if (Content != null && ViewType != null) {
    41         MainFormManager.MainForm.ShowContent(Content(), ViewType);
    42       }
     34      if (SurroundingView == null) return;
     35      if (SurroundingView.Content == null) return;
     36
     37      var view = MainFormManager.MainForm.ShowContent(SurroundingView.Content, SurroundingView.GetType());
     38      view.ReadOnly = SurroundingView.ReadOnly;
     39      view.Locked = SurroundingView.Locked;
    4340    }
    4441  }
Note: See TracChangeset for help on using the changeset viewer.