Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/05/10 10:31:40 (15 years ago)
Author:
gkronber
Message:

Copied refactored plugin infrastructure from branch and merged changeset r2586:2589 from branch into the trunk. #799

File:
1 edited

Legend:

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

    r2143 r2591  
    2626using System.Drawing;
    2727using System.Text;
     28using System.Linq;
    2829using System.Threading;
    2930using System.Windows.Forms;
     
    6869      form.Show(dockPanel);
    6970
    70       DiscoveryService discoveryService = new DiscoveryService();
    71 
    7271      // discover creatable items
    73       Type[] creatables = discoveryService.GetTypes(typeof(IEditable));
    74       string[] names = new string[creatables.Length];
    75       for (int i = 0; i < creatables.Length; i++)
    76         names[i] = creatables[i].Name;
    77       Array.Sort(names, creatables);
     72      var creatables = from x in ApplicationManager.Manager.GetTypes(typeof(IEditable))
     73                       orderby x.Name
     74                       select x;     
    7875      foreach (Type type in creatables) {
    7976        if (!type.IsAbstract) {
     
    10097    /// is neither a view nor an editor.</exception>
    10198    /// <param name="control">The control to display.</param>
    102     public void ShowControl(IControl control) {
    103       if (InvokeRequired) Invoke((Action<IControl>)ShowControl,control);
     99    public void ShowControl(object control) {
     100      if (InvokeRequired) Invoke((Action<object>)ShowControl, control);
    104101      else {
    105102        DockContent content;
     
    132129        saveAllToolStripButton.Enabled = true;
    133130        EditorForm form = ActiveMdiChild as EditorForm;
    134         if (form != null){
     131        if (form != null) {
    135132          if (((Control)form.Editor).Enabled) {
    136133            saveToolStripMenuItem.Enabled = true;
     
    158155      try {
    159156        task.storable = PersistenceManager.Load(task.filename);
    160       } catch(FileNotFoundException fileNotFoundEx) {
     157      }
     158      catch (FileNotFoundException fileNotFoundEx) {
    161159        MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe file or plugin \"" + fileNotFoundEx.FileName + "\" is not available.\nPlease make sure you have all necessary plugins installed.",
    162160          "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    163       } catch(TypeLoadException typeLoadEx) {
    164         MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe type \"" + typeLoadEx.TypeName+ "\" is not available.\nPlease make sure that you have the correct version the plugin installed.",
     161      }
     162      catch (TypeLoadException typeLoadEx) {
     163        MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe type \"" + typeLoadEx.TypeName + "\" is not available.\nPlease make sure that you have the correct version the plugin installed.",
    165164          "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    166165      }
    167       LoadFinished(task);
     166      finally {
     167        LoadFinished(task);
     168      }
    168169    }
    169170    private delegate void TaskFinishedDelegate(Task task);
     
    183184          editor.Filename = task.filename;
    184185          editor.SaveFinished += new EventHandler(SaveFinished);
    185           PluginManager.ControlManager.ShowControl(editor);
     186          ControlManager.Manager.ShowControl(editor);
    186187        }
    187188        lock (locker) {
     
    239240        } else {
    240241          editor.SaveFinished += new EventHandler(SaveFinished);
    241           PluginManager.ControlManager.ShowControl(editor);
     242          ControlManager.Manager.ShowControl(editor);
    242243          EnableDisableItems();
    243244        }
     
    298299      for (int i = 0; i < MdiChildren.Length; i++) {
    299300        EditorForm form = MdiChildren[i] as EditorForm;
    300         if (form!=null && ((Control)form.Editor).Enabled) Save(form);
     301        if (form != null && ((Control)form.Editor).Enabled) Save(form);
    301302      }
    302303    }
Note: See TracChangeset for help on using the changeset viewer.