Free cookie consent management tool by TermsFeed Policy Generator

Changeset 877


Ignore:
Timestamp:
11/30/08 01:07:30 (16 years ago)
Author:
swagner
Message:

Implemented a quick way to pass the name of an application as commandline option in order to start this application automatically. (#45)

Location:
trunk/sources/HeuristicLab
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab/MainForm.cs

    r601 r877  
    7979
    8080    private void applicationsListView_ItemActivate(object sender, EventArgs e) {
    81       if(applicationsListView.SelectedItems.Count > 0) {       
     81      if(applicationsListView.SelectedItems.Count > 0) {
    8282        ListViewItem selected = applicationsListView.SelectedItems[0];
    8383        if(selected == pluginManagerListViewItem) {
  • trunk/sources/HeuristicLab/Program.cs

    r2 r877  
    3030  static class Program {
    3131    [STAThread]
    32     static void Main() {
    33       Application.EnableVisualStyles();
    34       Application.SetCompatibleTextRenderingDefault(false);
    35       Application.Run(new MainForm());
     32    static void Main(string[] args) {
     33      if (args.Length == 0) {  // normal mode
     34        Application.EnableVisualStyles();
     35        Application.SetCompatibleTextRenderingDefault(false);
     36        Application.Run(new MainForm());
     37      } else if (args.Length == 1) {  // start specific application
     38        PluginManager.Manager.Initialize();
     39
     40        ApplicationInfo app = null;
     41        foreach (ApplicationInfo info in PluginManager.Manager.InstalledApplications) {
     42          if (info.Name == args[0])
     43            app = info;
     44        }
     45        if (app == null) {  // application not found
     46          MessageBox.Show("Cannot start application.\nApplication " + args[0] + " is not installed.\n\nStarting HeuristicLab in normal mode ...",
     47                          "HeuristicLab",
     48                          MessageBoxButtons.OK,
     49                          MessageBoxIcon.Warning);
     50          Application.EnableVisualStyles();
     51          Application.SetCompatibleTextRenderingDefault(false);
     52          Application.Run(new MainForm());
     53        } else {
     54          PluginManager.Manager.Run(app);
     55        }
     56      }
    3657    }
    3758  }
Note: See TracChangeset for help on using the changeset viewer.