Changeset 11557
- Timestamp:
- 11/19/14 14:26:07 (10 years ago)
- Location:
- trunk/sources/HeuristicLab.Core.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/ItemView.cs
r11555 r11557 47 47 48 48 if (CountParentControls() > MaximumNestingLevel) { 49 NestingLevelErrorControl errorControl = new NestingLevelErrorControl(); 49 //capture content, needed because it is set at a later time 50 NestingLevelErrorControl errorControl = new NestingLevelErrorControl(() => Content, this.GetType()); 50 51 errorControl.Dock = DockStyle.Fill; 51 //capture content, needed because it is set at a later time52 errorControl.Content = () => Content;53 52 54 53 Controls.Clear(); -
trunk/sources/HeuristicLab.Core.Views/3.3/NestingLevelErrorControl.cs
r11555 r11557 28 28 public partial class NestingLevelErrorControl : UserControl { 29 29 public Func<IContent> Content { get; set; } 30 public Type ViewType { get; set; } 30 31 31 32 public NestingLevelErrorControl() { … … 33 34 } 34 35 36 public NestingLevelErrorControl(Func<IContent> content, Type viewType) 37 : this() { 38 Content = content; 39 ViewType = viewType; 40 } 41 35 42 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 } 43 if (Content != null && ViewType != null) { 44 MainFormManager.MainForm.ShowContent(Content(), ViewType); 47 45 } 48 46 }
Note: See TracChangeset
for help on using the changeset viewer.