Changeset 11555 for trunk/sources/HeuristicLab.Core.Views/3.3/ItemView.cs
- Timestamp:
- 11/17/14 16:05:14 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/ItemView.cs
r11171 r11555 20 20 #endregion 21 21 22 using System; 23 using System.Windows.Forms; 22 24 using HeuristicLab.MainForm.WindowsForms; 23 25 … … 27 29 /// </summary> 28 30 public partial class ItemView : AsynchronousContentView { 31 public const int MaximumNestingLevel = 37; 32 29 33 public new IItem Content { 30 34 get { return (IItem)base.Content; } … … 38 42 InitializeComponent(); 39 43 } 44 45 protected override void OnInitialized(EventArgs e) { 46 base.OnInitialized(e); 47 48 if (CountParentControls() > MaximumNestingLevel) { 49 NestingLevelErrorControl errorControl = new NestingLevelErrorControl(); 50 errorControl.Dock = DockStyle.Fill; 51 //capture content, needed because it is set at a later time 52 errorControl.Content = () => Content; 53 54 Controls.Clear(); 55 Controls.Add(errorControl); 56 } 57 } 58 59 private int CountParentControls() { 60 int cnt = 0; 61 Control parent = Parent; 62 while (parent != null) { 63 parent = parent.Parent; 64 cnt++; 65 } 66 return cnt; 67 } 40 68 } 41 69 }
Note: See TracChangeset
for help on using the changeset viewer.