Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/04/12 10:34:44 (12 years ago)
Author:
jkarder
Message:

#1926:

  • created argument handling infrastructure
  • added StartArgument
Location:
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.Designer.cs

    r7967 r8563  
    181181      this.Name = "StarterForm";
    182182      this.Text = "HeuristicLab Starter";
    183       this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
     183      this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.StarterForm_FormClosing);
     184      this.Shown += new System.EventHandler(this.StarterForm_Shown);
    184185      this.ResumeLayout(false);
    185186
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.cs

    r7259 r8563  
    2626using System.Linq;
    2727using System.Threading;
     28using System.Threading.Tasks;
    2829using System.Windows.Forms;
    2930using HeuristicLab.PluginInfrastructure.Advanced;
    3031using HeuristicLab.PluginInfrastructure.Manager;
    31 using System.Threading.Tasks;
    3232
    3333namespace HeuristicLab.PluginInfrastructure.Starter {
     
    4646    private SplashScreen splashScreen;
    4747    private bool updatesAvailable = false;
     48    private string[] arguments;
     49
    4850    /// <summary>
    4951    /// Initializes an instance of the starter form.
     
    127129    }
    128130
     131    /// <summary>
     132    /// Creates a new StarterForm and passes the arguments in <paramref name="args"/>.
     133    /// </summary>
     134    /// <param name="args">The arguments that should be processed</param>
     135    public StarterForm(string[] args)
     136      : this() {
     137      this.arguments = args;
     138    }
     139
     140    private void StarterForm_Shown(object sender, EventArgs e) {
     141      foreach (var argument in ArgumentHandling.GetArguments(arguments)) {
     142        if (argument is StartArgument) {
     143          var appDesc = (from desc in pluginManager.Applications
     144                         where desc.Name == argument.Value
     145                         select desc).SingleOrDefault();
     146          if (appDesc != null) {
     147            StartApplication(appDesc);
     148          } else {
     149            MessageBox.Show("Cannot start application " + argument.Value + ".",
     150                            "HeuristicLab",
     151                            MessageBoxButtons.OK,
     152                            MessageBoxIcon.Warning);
     153          }
     154        }
     155      }
     156    }
     157
    129158    private void applicationsListView_ItemActivate(object sender, EventArgs e) {
    130159      if (applicationsListView.SelectedItems.Count > 0) {
     
    259288    }
    260289
    261     private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
     290    private void StarterForm_FormClosing(object sender, FormClosingEventArgs e) {
    262291      splashScreen.Close();
    263292      abortRequested = true;
Note: See TracChangeset for help on using the changeset viewer.