Changeset 2486
- Timestamp:
- 11/12/09 17:43:59 (15 years ago)
- Location:
- branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2/AvailableOperatorsForm.cs
r1529 r2486 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 (var 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) { 74 if(!type.IsAbstract) { 70 foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(IOperator), plugin)) { 71 if (!type.IsAbstract) { 75 72 TreeNode operatorItem = new TreeNode(); 76 73 operatorItem.Text = type.Name; … … 80 77 } 81 78 // add plugin node only if it contains operators 82 if (pluginItem.Nodes.Count > 0) {79 if (pluginItem.Nodes.Count > 0) { 83 80 builtinOperatorsTreeView.Nodes.Add(pluginItem); 84 81 } -
branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2/HeuristicLab.AdvancedOptimizationFrontend-3.2.csproj
r2134 r2486 11 11 <RootNamespace>HeuristicLab.AdvancedOptimizationFrontend</RootNamespace> 12 12 <AssemblyName>HeuristicLab.AdvancedOptimizationFrontend-3.2</AssemblyName> 13 <TargetFrameworkVersion>v 2.0</TargetFrameworkVersion>13 <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> 14 14 <FileAlignment>512</FileAlignment> 15 15 <SignAssembly>true</SignAssembly> … … 70 70 <ItemGroup> 71 71 <Reference Include="System" /> 72 <Reference Include="System.Core"> 73 <RequiredTargetFramework>3.5</RequiredTargetFramework> 74 </Reference> 72 75 <Reference Include="System.Data" /> 73 76 <Reference Include="System.Drawing" /> -
branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2/HeuristicLabAdvancedOptimizationFrontendApplication.cs
r1529 r2486 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 } -
branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2/HeuristicLabAdvancedOptimizationFrontendPlugin.cs
r2134 r2486 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")]32 [Plugin("HeuristicLab.AdvancedOptimizationFrontend-3.2")] 33 [PluginFile("HeuristicLab.AdvancedOptimizationFrontend-3.2.dll", PluginFileType.Assembly)] 34 [PluginDependency("HeuristicLab.Core-3.2")] 35 35 public class HeuristicLabAdvancedOptimizationFrontendPlugin : PluginBase { 36 36 } -
branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2/MainForm.cs
r2143 r2486 32 32 using HeuristicLab.Core; 33 33 using System.IO; 34 using System.Linq; 34 35 35 36 namespace HeuristicLab.AdvancedOptimizationFrontend { … … 68 69 form.Show(dockPanel); 69 70 70 DiscoveryService discoveryService = new DiscoveryService(); 71 72 // 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); 78 foreach (Type type in creatables) { 71 foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(IEditable)).OrderBy(x => x.Name)) { 79 72 if (!type.IsAbstract) { 80 73 ToolStripMenuItem item = new ToolStripMenuItem(); … … 101 94 /// <param name="control">The control to display.</param> 102 95 public void ShowControl(IControl control) { 103 if (InvokeRequired) Invoke((Action<IControl>)ShowControl, control);96 if (InvokeRequired) Invoke((Action<IControl>)ShowControl, control); 104 97 else { 105 98 DockContent content; … … 132 125 saveAllToolStripButton.Enabled = true; 133 126 EditorForm form = ActiveMdiChild as EditorForm; 134 if (form != null) {127 if (form != null) { 135 128 if (((Control)form.Editor).Enabled) { 136 129 saveToolStripMenuItem.Enabled = true; … … 158 151 try { 159 152 task.storable = PersistenceManager.Load(task.filename); 160 } catch(FileNotFoundException fileNotFoundEx) { 153 } 154 catch (FileNotFoundException fileNotFoundEx) { 161 155 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 156 "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.", 157 } 158 catch (TypeLoadException typeLoadEx) { 159 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 160 "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 166 161 } 167 LoadFinished(task); 162 finally { 163 LoadFinished(task); 164 } 168 165 } 169 166 private delegate void TaskFinishedDelegate(Task task); … … 183 180 editor.Filename = task.filename; 184 181 editor.SaveFinished += new EventHandler(SaveFinished); 185 PluginManager.ControlManager.ShowControl(editor);182 ControlManager.Manager.ShowControl(editor); 186 183 } 187 184 lock (locker) { … … 239 236 } else { 240 237 editor.SaveFinished += new EventHandler(SaveFinished); 241 PluginManager.ControlManager.ShowControl(editor);238 ControlManager.Manager.ShowControl(editor); 242 239 EnableDisableItems(); 243 240 } … … 298 295 for (int i = 0; i < MdiChildren.Length; i++) { 299 296 EditorForm form = MdiChildren[i] as EditorForm; 300 if (form !=null && ((Control)form.Editor).Enabled) Save(form);297 if (form != null && ((Control)form.Editor).Enabled) Save(form); 301 298 } 302 299 }
Note: See TracChangeset
for help on using the changeset viewer.