Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2541


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

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

Location:
trunk/sources
Files:
7 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);
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ToolBarItemBase.cs

    r2458 r2541  
    2424using System.Text;
    2525using System.Windows.Forms;
    26                                                            
     26
    2727namespace HeuristicLab.MainForm.WindowsForms {
    2828  public abstract class ToolBarItemBase : HeuristicLab.MainForm.ToolBarItemBase {
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ViewBase.cs

    r2532 r2541  
    6969    }
    7070
    71     public event EventHandler Initialize;
     71    public event EventHandler Initialized;
    7272
    7373    private void ViewBase_Load(object sender, EventArgs e) {
    7474      if (!this.initialized && !this.DesignMode) {
    75         if (this.Initialize != null)
    76           this.Initialize(this, new EventArgs());
     75        if (this.Initialized != null)
     76          this.Initialized(this, new EventArgs());
    7777        this.initialized = true;
    7878      }
  • trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IUserInterfaceItem.cs

    r2458 r2541  
    3838    void ViewChanged(object sender, EventArgs e);
    3939    void MainFormChanged(object sender, EventArgs e);
     40    void MainFormInitialized(object sender, EventArgs e);
    4041  }
    4142}
  • trunk/sources/HeuristicLab.MainForm/3.2/MenuSeparatorItemBase.cs

    r2514 r2541  
    3737      throw new NotImplementedException();
    3838    }
     39
     40    public void MainFormInitialized(object sender, EventArgs e) {
     41      throw new NotImplementedException();
     42    }
    3943  }
    4044}
  • trunk/sources/HeuristicLab.MainForm/3.2/ToolBarSeparatorItemBase.cs

    r2514 r2541  
    3939      throw new NotImplementedException();
    4040    }
     41
     42    public void MainFormInitialized(object sender, EventArgs e) {
     43      throw new NotImplementedException();
     44    }
    4145  }
    4246}
  • trunk/sources/HeuristicLab.MainForm/3.2/UserInterfaceItemBase.cs

    r2458 r2541  
    5151    public virtual void MainFormChanged(object sender, EventArgs e) {
    5252    }
     53
     54    public virtual void MainFormInitialized(object sender, EventArgs e) {
     55    }
    5356  }
    5457}
Note: See TracChangeset for help on using the changeset viewer.