- Timestamp:
- 11/19/09 15:46:55 (15 years ago)
- Location:
- branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure
- Files:
-
- 1 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj
r2504 r2507 116 116 <SubType>Designer</SubType> 117 117 </EmbeddedResource> 118 <EmbeddedResource Include="Starter\MainForm.resx">119 <DependentUpon>MainForm.cs</DependentUpon>120 </EmbeddedResource>121 118 <EmbeddedResource Include="Starter\SplashScreen.resx"> 122 119 <DependentUpon>SplashScreen.cs</DependentUpon> 120 </EmbeddedResource> 121 <EmbeddedResource Include="Starter\StarterForm.resx"> 122 <DependentUpon>StarterForm.cs</DependentUpon> 123 123 </EmbeddedResource> 124 124 <Compile Include="Properties\Resources.Designer.cs"> … … 139 139 <DesignTimeSharedInput>True</DesignTimeSharedInput> 140 140 </Compile> 141 <Compile Include="Starter\MainForm.cs">142 <SubType>Form</SubType>143 </Compile>144 <Compile Include="Starter\MainForm.Designer.cs">145 <DependentUpon>MainForm.cs</DependentUpon>146 </Compile>147 141 <Compile Include="Starter\SplashScreen.cs"> 148 142 <SubType>Form</SubType> … … 150 144 <Compile Include="Starter\SplashScreen.Designer.cs"> 151 145 <DependentUpon>SplashScreen.cs</DependentUpon> 146 </Compile> 147 <Compile Include="Starter\StarterForm.cs"> 148 <SubType>Form</SubType> 149 </Compile> 150 <Compile Include="Starter\StarterForm.Designer.cs"> 151 <DependentUpon>StarterForm.cs</DependentUpon> 152 152 </Compile> 153 153 </ItemGroup> -
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Starter/StarterForm.Designer.cs
r2504 r2507 21 21 22 22 namespace HeuristicLab.PluginInfrastructure { 23 partial class MainForm {23 partial class StarterForm { 24 24 /// <summary> 25 25 /// Required designer variable. … … 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof( MainForm));48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(StarterForm)); 49 49 System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Plugin Management", System.Windows.Forms.HorizontalAlignment.Left); 50 50 System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Applications", System.Windows.Forms.HorizontalAlignment.Left); -
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Starter/StarterForm.cs
r2505 r2507 21 21 22 22 using System; 23 using System.Linq; 23 24 using System.Collections.Generic; 24 25 using System.ComponentModel; … … 34 35 35 36 namespace HeuristicLab.PluginInfrastructure { 36 public partial class MainForm : Form {37 public partial class StarterForm : Form { 37 38 38 39 private ListViewItem pluginManagerListViewItem; … … 40 41 private PluginManager pluginManager; 41 42 42 public MainForm()43 public StarterForm() 43 44 : base() { 44 45 InitializeComponent(); … … 76 77 } 77 78 79 public StarterForm(string appName) 80 : this() { 81 var appDesc = (from desc in pluginManager.Applications 82 where desc.Name == appName 83 select desc).Single(); 84 if (appDesc != null) { 85 StartApplication(appDesc); 86 } else { 87 MessageBox.Show("Cannot start application " + appName + ".", 88 "HeuristicLab", 89 MessageBoxButtons.OK, 90 MessageBoxIcon.Warning); 91 } 92 } 93 78 94 private void applicationsListView_ItemActivate(object sender, EventArgs e) { 79 95 if (applicationsListView.SelectedItems.Count > 0) { … … 93 109 } else { 94 110 ApplicationDescription app = (ApplicationDescription)applicationsListView.SelectedItems[0].Tag; 95 SplashScreen splashScreen = new SplashScreen(pluginManager, 2000, "Loading " + app.Name); 96 splashScreen.Show(); 97 Thread t = new Thread(delegate() { 98 bool stopped = false; 99 do { 100 try { 101 if (!abortRequested) 102 pluginManager.Run(app); 103 stopped = true; 104 } 105 catch (Exception ex) { 106 stopped = false; 107 ThreadPool.QueueUserWorkItem(delegate(object exception) { ShowErrorMessageBox((Exception)exception); }, ex); 108 Thread.Sleep(5000); // sleep 5 seconds before autorestart 109 } 110 } while (!abortRequested && !stopped && app.AutoRestart); 111 }); 112 t.SetApartmentState(ApartmentState.STA); // needed for the AdvancedOptimizationFrontent 113 t.Start(); 111 StartApplication(app); 114 112 } 115 113 } 114 } 115 116 private void StartApplication(ApplicationDescription app) { 117 SplashScreen splashScreen = new SplashScreen(pluginManager, 2000, "Loading " + app.Name); 118 splashScreen.Show(); 119 Thread t = new Thread(delegate() { 120 bool stopped = false; 121 do { 122 try { 123 if (!abortRequested) 124 pluginManager.Run(app); 125 stopped = true; 126 } 127 catch (Exception ex) { 128 stopped = false; 129 ThreadPool.QueueUserWorkItem(delegate(object exception) { ShowErrorMessageBox((Exception)exception); }, ex); 130 Thread.Sleep(5000); // sleep 5 seconds before autorestart 131 } 132 } while (!abortRequested && !stopped && app.AutoRestart); 133 }); 134 t.SetApartmentState(ApartmentState.STA); // needed for the AdvancedOptimizationFrontent 135 t.Start(); 116 136 } 117 137
Note: See TracChangeset
for help on using the changeset viewer.