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
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj

    r7649 r8563  
    223223      <DependentUpon>PluginView.cs</DependentUpon>
    224224    </Compile>
     225    <Compile Include="ArgumentHandling\ArgumentHandling.cs" />
     226    <Compile Include="ArgumentHandling\Arguments.cs" />
     227    <Compile Include="ArgumentHandling\IArgument.cs" />
    225228    <Compile Include="Attributes\ApplicationAttribute.cs" />
    226229    <Compile Include="Attributes\ContactInformationAttribute.cs" />
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Main.cs

    r7259 r8563  
    4242          Application.EnableVisualStyles();
    4343          Application.SetCompatibleTextRenderingDefault(false);
    44           Application.Run(new StarterForm());
     44          Application.Run(new StarterForm(args));
    4545        }
    4646        catch (Exception ex) {
  • 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.