Changeset 2591 for trunk/sources/HeuristicLab.AdvancedOptimizationFrontend
- Timestamp:
- 01/05/10 10:31:40 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.AdvancedOptimizationFrontend/3.2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.AdvancedOptimizationFrontend/3.2/AvailableOperatorsForm.cs
r1529 r2591 63 63 builtinOperatorsTreeView.TreeViewNodeSorter = nodeSorter; 64 64 65 DiscoveryService discoveryService = new DiscoveryService(); 66 PluginInfo[] plugins = discoveryService.Plugins; 67 foreach(PluginInfo plugin in plugins) { 65 foreach(IPluginDescription plugin in ApplicationManager.Manager.Plugins) { 68 66 TreeNode pluginItem = new TreeNode(); 69 67 pluginItem.Text = plugin.Name; 70 68 pluginItem.Tag = plugin; 71 69 72 Type[] operators = discoveryService.GetTypes(typeof(IOperator), plugin); 73 foreach(Type type in operators) { 70 foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(IOperator), plugin)) { 74 71 if(!type.IsAbstract) { 75 72 TreeNode operatorItem = new TreeNode(); -
trunk/sources/HeuristicLab.AdvancedOptimizationFrontend/3.2/HeuristicLabAdvancedOptimizationFrontendApplication.cs
r1529 r2591 30 30 /// The HeuristicLab Advanced Optimization Frontend Application. 31 31 /// </summary> 32 [ ClassInfo(Name = "HeuristicLab 3.2 (dockable)", Description="Next generation heuristic optimization environment.")]32 [Application("HeuristicLab 3.2 (dockable)", "Next generation heuristic optimization environment.")] 33 33 class HeuristicLabAdvancedOptimizationFrontendApplication : ApplicationBase { 34 34 /// <summary> … … 37 37 public override void Run() { 38 38 Form mainForm = new MainForm(); 39 PluginManager.ControlManager = (IControlManager)mainForm;39 ControlManager.RegisterManager((IControlManager)mainForm); 40 40 Application.Run(mainForm); 41 41 } -
trunk/sources/HeuristicLab.AdvancedOptimizationFrontend/3.2/HeuristicLabAdvancedOptimizationFrontendPlugin.cs
r2479 r2591 30 30 /// Plugin class for HeuristicLab.AdvancedOptimizationFrontend plugin. 31 31 /// </summary> 32 [ ClassInfo(Name ="HeuristicLab.AdvancedOptimizationFrontend-3.2")]33 [PluginFile( Filename = "HeuristicLab.AdvancedOptimizationFrontend-3.2.dll", Filetype =PluginFileType.Assembly)]34 [ Dependency(Dependency ="HeuristicLab.Core-3.2")]35 [ Dependency(Dependency ="HeuristicLab.MainForm.WindowsForms-3.2")]32 [Plugin("HeuristicLab.AdvancedOptimizationFrontend-3.2")] 33 [PluginFile("HeuristicLab.AdvancedOptimizationFrontend-3.2.dll", PluginFileType.Assembly)] 34 [PluginDependency("HeuristicLab.Core-3.2")] 35 [PluginDependency("HeuristicLab.MainForm.WindowsForms-3.2")] 36 36 public class HeuristicLabAdvancedOptimizationFrontendPlugin : PluginBase { 37 37 } -
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.