Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/03/09 15:12:44 (15 years ago)
Author:
mkommend
Message:

adapted MainForm to fire an initialized event and renamed the event in ViewBase to Initialized (ticket #771)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/MainFormBase.cs

    r2539 r2541  
    3333namespace HeuristicLab.MainForm.WindowsForms {
    3434  public partial class MainFormBase : Form, IMainForm {
     35
     36    private bool initialized;
    3537    protected MainFormBase()
    3638      : base() {
     
    3840      this.views = new Dictionary<IView, Form>();
    3941      this.userInterfaceItems = new List<IUserInterfaceItem>();
     42      this.initialized = false;
    4043    }
    4144
     
    4447      this.userInterfaceItemType = userInterfaceItemType;
    4548      CreateGUI();
    46       OnMainFormChanged();
    4749    }
    4850
    4951    private void MainFormBase_Load(object sender, EventArgs e) {
    50       if (!DesignMode)
     52      if (!DesignMode) {
    5153        MainFormManager.RegisterMainForm(this);
    52     }
     54        if (!this.initialized) {
     55          this.initialized = true;
     56          if (this.Initialized != null)
     57            this.Initialized(this,new EventArgs());
     58        }
     59      }
     60    }
     61
     62    public event EventHandler Initialized;
    5363
    5464    #region IMainForm Members
     
    239249        this.InsertItem(menuItem.Structure, typeof(ToolStripMenuItem), new ToolStripSeparator(), menuStrip.Items);
    240250      }
    241      }
     251    }
    242252
    243253    private void AddToolStripButtonItem(IToolBarItem buttonItem) {
     
    253263        item.DisplayStyle = ((ToolBarItemBase)buttonItem).ToolStripItemDisplayStyle;
    254264        ((ToolBarItemBase)buttonItem).ToolStripItem = item;
    255       } else if (buttonItem is IToolBarSeparatorItem) 
     265      } else if (buttonItem is IToolBarSeparatorItem)
    256266        item = new ToolStripSeparator();
    257      
     267
    258268      this.InsertItem(buttonItem.Structure, typeof(ToolStripDropDownButton), item, toolStrip.Items);
    259269    }
     
    281291      this.ActiveViewChanged += new EventHandler(userInterfaceItem.ActiveViewChanged);
    282292      this.Changed += new EventHandler(userInterfaceItem.MainFormChanged);
     293      this.Initialized += new EventHandler(userInterfaceItem.MainFormInitialized);
    283294      toolStripItem.Click += new EventHandler(ToolStripItemClicked);
    284295      this.userInterfaceItems.Add(userInterfaceItem);
Note: See TracChangeset for help on using the changeset viewer.