Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/19/14 14:26:07 (9 years ago)
Author:
ascheibe
Message:

#2158 improved error handling for nested views

File:
1 edited

Legend:

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

    r11555 r11557  
    2828  public partial class NestingLevelErrorControl : UserControl {
    2929    public Func<IContent> Content { get; set; }
     30    public Type ViewType { get; set; }
    3031
    3132    public NestingLevelErrorControl() {
     
    3334    }
    3435
     36    public NestingLevelErrorControl(Func<IContent> content, Type viewType)
     37      : this() {
     38      Content = content;
     39      ViewType = viewType;
     40    }
     41
    3542    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);
    4745      }
    4846    }
Note: See TracChangeset for help on using the changeset viewer.