Ignore:
Timestamp:
08/06/09 12:32:27 (12 years ago)
Author:
mkommend
Message:

adapted HeuristicLab.MainForm.Test to use HL.Common.Resources (ticket #716)

File:
1 edited

Legend:

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

    r2243 r2247  
    7979      Type[] userInterfaceTypes = ds.GetTypes(userInterfaceItemType);
    8080
    81       foreach (Type t in userInterfaceTypes.Where(t=> typeof(IToolStripMenuItem).IsAssignableFrom(t))) {
    82         if (!t.IsAbstract && !t.IsInterface && !t.HasElementType) {
    83           IToolStripMenuItem item = (IToolStripMenuItem) Activator.CreateInstance(t);
    84           AddToolStripMenuItem(item);
    85         }
     81      object[] items = ds.GetInstances(userInterfaceItemType);
     82      IEnumerable<IToolStripItem> toolStripItems = items.Where(mi => mi as IToolStripMenuItem != null).Cast<IToolStripItem>();
     83      toolStripItems = toolStripItems.OrderBy(x => x.Position);
     84      foreach (IToolStripMenuItem menuItem in toolStripItems) {
     85        AddToolStripMenuItem(menuItem);
    8686      }
    8787
    88       foreach (Type t in userInterfaceTypes.Where(t => typeof(IToolStripButtonItem).IsAssignableFrom(t))) {
    89         if (!t.IsAbstract && !t.IsInterface && !t.HasElementType) {
    90           IToolStripButtonItem item = (IToolStripButtonItem)Activator.CreateInstance(t);
    91           AddToolStripButtonItem(item);
    92         }
     88      items = ds.GetInstances(userInterfaceItemType);
     89      toolStripItems = items.Where(mi => mi as IToolStripButtonItem != null).Cast<IToolStripItem>();
     90      toolStripItems = toolStripItems.OrderBy(x => x.Position);
     91      foreach (IToolStripButtonItem toolStripButtonItem in toolStripItems) {
     92        AddToolStripButtonItem(toolStripButtonItem);
    9393      }
    9494    }
Note: See TracChangeset for help on using the changeset viewer.