- Timestamp:
- 10/17/12 21:46:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.cs
r8748 r8818 39 39 private const string pluginManagerItemName = "Plugin Manager"; 40 40 private const string updatePluginsItemName = "Updates Available"; 41 private const string optimizerItemName = "Optimizer"; 41 42 42 43 private readonly ICommandLineArgument[] arguments; … … 84 85 85 86 protected override void SetVisibleCore(bool value) { 86 value &= ! arguments.OfType<HideStarterArgument>().Any();87 value &= !(arguments.OfType<HideStarterArgument>().Any() || arguments.OfType<OpenArgument>().Any()); 87 88 if (!value) HandleArguments(); 88 89 base.SetVisibleCore(value); … … 144 145 } else { 145 146 ApplicationDescription app = (ApplicationDescription)applicationsListView.SelectedItems[0].Tag; 146 StartApplication(app );147 StartApplication(app, arguments); 147 148 } 148 149 } … … 171 172 private void splashScreen_VisibleChanged(object sender, EventArgs e) { 172 173 // close hidden starter form 173 if (!splashScreen.Visible && arguments != null && arguments.OfType<HideStarterArgument>().Any()) 174 if (!splashScreen.Visible && arguments != null && 175 (arguments.OfType<HideStarterArgument>().Any() || arguments.OfType<OpenArgument>().Any())) 174 176 Close(); 175 177 } … … 263 265 private void HandleArguments() { 264 266 try { 267 if (arguments.OfType<OpenArgument>().Any() && !arguments.OfType<StartArgument>().Any()) { 268 InitiateApplicationStart(optimizerItemName); 269 } 265 270 foreach (var argument in arguments) { 266 271 if (argument is StartArgument) { 267 var appDesc = (from desc in pluginManager.Applications 268 where desc.Name.Equals(argument.Value) 269 select desc).SingleOrDefault(); 270 if (appDesc != null) { 271 StartApplication(appDesc); 272 } else { 273 MessageBox.Show("Cannot start application " + argument.Value + ".", 274 "HeuristicLab", 275 MessageBoxButtons.OK, 276 MessageBoxIcon.Warning); 277 } 272 var arg = (StartArgument)argument; 273 InitiateApplicationStart(arg.Value); 278 274 } 279 275 } … … 284 280 } 285 281 286 private void StartApplication(ApplicationDescription app) { 282 private void InitiateApplicationStart(string appName) { 283 var appDesc = (from desc in pluginManager.Applications 284 where desc.Name.Equals(appName) 285 select desc).SingleOrDefault(); 286 if (appDesc != null) { 287 StartApplication(appDesc, arguments); 288 } else { 289 MessageBox.Show("Cannot start application " + appName + ".", 290 "HeuristicLab", 291 MessageBoxButtons.OK, 292 MessageBoxIcon.Warning); 293 } 294 } 295 296 private void StartApplication(ApplicationDescription app, ICommandLineArgument[] args) { 287 297 splashScreen.Show("Loading " + app.Name); 288 298 Thread t = new Thread(delegate() { … … 291 301 try { 292 302 if (!abortRequested) { 293 pluginManager.Run(app );303 pluginManager.Run(app, args); 294 304 } 295 305 stopped = true;
Note: See TracChangeset
for help on using the changeset viewer.