Changeset 13389 for branches/RefactorPluginInfrastructure-2522/HeuristicLab
- Timestamp:
- 11/24/15 19:02:57 (9 years ago)
- Location:
- branches/RefactorPluginInfrastructure-2522/HeuristicLab/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RefactorPluginInfrastructure-2522/HeuristicLab/3.3/HeuristicLab-3.3.csproj
r13340 r13389 193 193 <Private>False</Private> 194 194 </ProjectReference> 195 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> 196 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> 197 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 198 </ProjectReference> 195 199 </ItemGroup> 196 200 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/RefactorPluginInfrastructure-2522/HeuristicLab/3.3/Program.cs
r13338 r13389 21 21 22 22 using System; 23 using System.IO; 24 using System.Linq; 25 using System.Threading; 26 using System.Threading.Tasks; 23 27 using System.Windows.Forms; 28 using HeuristicLab.PluginInfrastructure; 24 29 using HeuristicLab.PluginInfrastructure.UI; 25 30 … … 41 46 Application.EnableVisualStyles(); 42 47 Application.SetCompatibleTextRenderingDefault(false); 43 Application.Run(new StarterForm(args)); 48 49 string pluginPath = Path.GetFullPath(Application.StartupPath); 50 51 var pluginManager = new PluginManager(pluginPath); 52 53 var splashScreen = new SplashScreen("Loading plugins...", 3000); 54 pluginManager.Initializing += (sender, eventArgs) => splashScreen.UpdateMessage("Loading plugins..."); 55 pluginManager.PluginLoaded += (sender, eventArgs) => splashScreen.UpdateMessage("Loaded " + eventArgs.Entity.ToString()); 56 pluginManager.ApplicationStarting += (sender, eventArgs) => splashScreen.UpdateMessage("Starting " + eventArgs.Entity.ToString()); 57 pluginManager.ApplicationStarted += (sender, eventArgs) => splashScreen.UpdateMessage("Started " + eventArgs.Entity.ToString()); 58 59 60 DiscoverPluginsAndRunOptimizerAsync(pluginManager, args); 61 62 Application.Run(splashScreen); 44 63 } catch (Exception ex) { 45 64 MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); … … 47 66 } 48 67 } 68 69 private static void DiscoverPluginsAndRunOptimizerAsync(PluginManager pluginManager, string[] args) { 70 // STAThread is necessary for a UI component we are using in the application 71 var t = new Thread(() => { 72 try { 73 pluginManager.DiscoverAndCheckPlugins(); 74 var optimizerApp = pluginManager.Applications.FirstOrDefault(app => app.Name == "Optimizer"); 75 pluginManager.Run(optimizerApp, CommandLineArgumentHandling.GetArguments(args)); 76 } catch (Exception ex) { 77 MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); 78 } 79 }); 80 81 // cannot use a task because we need to set STA 82 t.SetApartmentState(ApartmentState.STA); 83 t.Start(); 84 } 49 85 } 50 86 }
Note: See TracChangeset
for help on using the changeset viewer.