- Timestamp:
- 01/05/10 10:31:40 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.AdvancedOptimizationFrontend/3.2/MainForm.cs
r2143 r2591 26 26 using System.Drawing; 27 27 using System.Text; 28 using System.Linq; 28 29 using System.Threading; 29 30 using System.Windows.Forms; … … 68 69 form.Show(dockPanel); 69 70 70 DiscoveryService discoveryService = new DiscoveryService();71 72 71 // 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; 78 75 foreach (Type type in creatables) { 79 76 if (!type.IsAbstract) { … … 100 97 /// is neither a view nor an editor.</exception> 101 98 /// <param name="control">The control to display.</param> 102 public void ShowControl( IControlcontrol) {103 if (InvokeRequired) Invoke((Action< IControl>)ShowControl,control);99 public void ShowControl(object control) { 100 if (InvokeRequired) Invoke((Action<object>)ShowControl, control); 104 101 else { 105 102 DockContent content; … … 132 129 saveAllToolStripButton.Enabled = true; 133 130 EditorForm form = ActiveMdiChild as EditorForm; 134 if (form != null) {131 if (form != null) { 135 132 if (((Control)form.Editor).Enabled) { 136 133 saveToolStripMenuItem.Enabled = true; … … 158 155 try { 159 156 task.storable = PersistenceManager.Load(task.filename); 160 } catch(FileNotFoundException fileNotFoundEx) { 157 } 158 catch (FileNotFoundException fileNotFoundEx) { 161 159 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.", 162 160 "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.", 165 164 "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 166 165 } 167 LoadFinished(task); 166 finally { 167 LoadFinished(task); 168 } 168 169 } 169 170 private delegate void TaskFinishedDelegate(Task task); … … 183 184 editor.Filename = task.filename; 184 185 editor.SaveFinished += new EventHandler(SaveFinished); 185 PluginManager.ControlManager.ShowControl(editor);186 ControlManager.Manager.ShowControl(editor); 186 187 } 187 188 lock (locker) { … … 239 240 } else { 240 241 editor.SaveFinished += new EventHandler(SaveFinished); 241 PluginManager.ControlManager.ShowControl(editor);242 ControlManager.Manager.ShowControl(editor); 242 243 EnableDisableItems(); 243 244 } … … 298 299 for (int i = 0; i < MdiChildren.Length; i++) { 299 300 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); 301 302 } 302 303 }
Note: See TracChangeset
for help on using the changeset viewer.