Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/14/12 18:58:15 (12 years ago)
Author:
gkronber
Message:

#1847 merged r8205:8635 from trunk into branch

Location:
branches/GP-MoveOperators
Files:
11 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/GP-MoveOperators

  • branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling/FrameworkVersionErrorDialog.Designer.cs

    r8085 r8660  
    4949      this.linkLabel = new System.Windows.Forms.LinkLabel();
    5050      this.label = new System.Windows.Forms.Label();
     51      this.linkLabelMono = new System.Windows.Forms.LinkLabel();
    5152      this.SuspendLayout();
    5253      //
    5354      // iconLabel
    5455      //
    55       this.iconLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    56                   | System.Windows.Forms.AnchorStyles.Left)));
     56      this.iconLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     57            | System.Windows.Forms.AnchorStyles.Left)));
    5758      this.iconLabel.Image = global::HeuristicLab.PluginInfrastructure.Resources.Error;
    5859      this.iconLabel.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
    5960      this.iconLabel.Location = new System.Drawing.Point(12, 9);
    6061      this.iconLabel.Name = "iconLabel";
    61       this.iconLabel.Size = new System.Drawing.Size(50, 98);
     62      this.iconLabel.Size = new System.Drawing.Size(50, 121);
    6263      this.iconLabel.TabIndex = 0;
    6364      //
     
    6667      this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    6768      this.closeButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    68       this.closeButton.Location = new System.Drawing.Point(294, 81);
     69      this.closeButton.Location = new System.Drawing.Point(294, 104);
    6970      this.closeButton.Name = "closeButton";
    7071      this.closeButton.Size = new System.Drawing.Size(75, 23);
     
    7677      // linkLabel
    7778      //
    78       this.linkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    79                   | System.Windows.Forms.AnchorStyles.Left)
    80                   | System.Windows.Forms.AnchorStyles.Right)));
     79      this.linkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     80            | System.Windows.Forms.AnchorStyles.Left)
     81            | System.Windows.Forms.AnchorStyles.Right)));
    8182      this.linkLabel.Location = new System.Drawing.Point(68, 52);
    8283      this.linkLabel.Name = "linkLabel";
    83       this.linkLabel.Size = new System.Drawing.Size(301, 26);
     84      this.linkLabel.Size = new System.Drawing.Size(301, 49);
    8485      this.linkLabel.TabIndex = 2;
    8586      this.linkLabel.TabStop = true;
     
    8990      // label
    9091      //
    91       this.label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    92                   | System.Windows.Forms.AnchorStyles.Right)));
     92      this.label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     93            | System.Windows.Forms.AnchorStyles.Right)));
    9394      this.label.Location = new System.Drawing.Point(68, 9);
    9495      this.label.Name = "label";
    9596      this.label.Size = new System.Drawing.Size(301, 43);
    9697      this.label.TabIndex = 1;
    97       this.label.Text = "The Microsoft .NET Framework 4 (Full Profile) is not properly installed on your s" +
    98           "ystem. Please download and install it.";
     98      this.label.Text = "To run HeuristicLab you need at least the Microsoft .NET Framework 4 (Full Profil" +
     99    "e) or Mono version 2.11.4 or higher. Please download and install it.";
     100      //
     101      // linkLabelMono
     102      //
     103      this.linkLabelMono.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     104            | System.Windows.Forms.AnchorStyles.Left)
     105            | System.Windows.Forms.AnchorStyles.Right)));
     106      this.linkLabelMono.Location = new System.Drawing.Point(68, 72);
     107      this.linkLabelMono.Name = "linkLabelMono";
     108      this.linkLabelMono.Size = new System.Drawing.Size(301, 16);
     109      this.linkLabelMono.TabIndex = 4;
     110      this.linkLabelMono.TabStop = true;
     111      this.linkLabelMono.Text = "Download Mono";
     112      this.linkLabelMono.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelMono_LinkClicked);
    99113      //
    100114      // FrameworkVersionErrorDialog
    101115      //
    102116      this.AcceptButton = this.closeButton;
    103       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    104117      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    105118      this.CancelButton = this.closeButton;
    106       this.ClientSize = new System.Drawing.Size(381, 116);
     119      this.ClientSize = new System.Drawing.Size(381, 139);
     120      this.Controls.Add(this.linkLabelMono);
    107121      this.Controls.Add(this.label);
    108122      this.Controls.Add(this.linkLabel);
     
    127141    private System.Windows.Forms.LinkLabel linkLabel;
    128142    private System.Windows.Forms.Label label;
     143    private System.Windows.Forms.LinkLabel linkLabelMono;
    129144  }
    130145}
  • branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling/FrameworkVersionErrorDialog.cs

    r7259 r8660  
    88 * it under the terms of the GNU General Public License as published by
    99 * the Free Software Foundation, either version 3 of the License, or
    10   * (at your option) any later version.
    11   *
    12   * HeuristicLab is distributed in the hope that it will be useful,
    13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15   * GNU General Public License for more details.
    16   *
    17   * You should have received a copy of the GNU General Public License
    18   * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    19   */
     10  * (at your option) any later version.
     11  *
     12  * HeuristicLab is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  * GNU General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU General Public License
     18  * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19  */
    2020#endregion
    2121
    2222using System;
     23using System.Reflection;
    2324using System.Windows.Forms;
    2425
     
    2627  public partial class FrameworkVersionErrorDialog : Form {
    2728    public static bool NET4FullProfileInstalled {
    28       get { return Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full") != null; }
     29      get {
     30        try {
     31          return Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full") != null;
     32        }
     33        catch (System.Security.SecurityException) {
     34          return false;
     35        }
     36      }
     37    }
     38
     39    public static bool MonoInstalled {
     40      get { return Type.GetType("Mono.Runtime") != null; }
     41    }
     42
     43    public static bool MonoCorrectVersionInstalled {
     44      get {
     45        var version = MonoVersion;
     46
     47        //we need at least mono version 2.11.4
     48        if (version != null && version.Major >= 2 && version.Minor >= 11 && version.Build >= 4) {
     49          return true;
     50        } else {
     51          return false;
     52        }
     53      }
     54    }
     55
     56    public static Version MonoVersion {
     57      get {
     58        Type type = Type.GetType("Mono.Runtime");
     59        if (type != null) {
     60          MethodInfo dispalayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
     61          if (dispalayName != null) {
     62            string versionString = dispalayName.Invoke(null, null) as string;
     63            if (versionString != null) {
     64              // the version string looks something like: 2.11.4 (master/99d5e54 Thu Sep  6 15:55:44 CEST 2012)
     65              var subVerStrings = versionString.Split(' ');
     66              if (subVerStrings.Length > 0) {
     67                try {
     68                  return Version.Parse(subVerStrings[0]);
     69                }
     70                catch { }
     71              }
     72            }
     73          }
     74        }
     75        return null;
     76      }
    2977    }
    3078
     
    4492      Application.Exit();
    4593    }
     94
     95    private void linkLabelMono_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
     96      try {
     97        System.Diagnostics.Process.Start("http://www.mono-project.org");
     98        linkLabelMono.LinkVisited = true;
     99      }
     100      catch (Exception) { }
     101    }
    46102  }
    47103}
  • branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj

    r7649 r8660  
    102102  </PropertyGroup>
    103103  <ItemGroup>
    104     <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.369, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
    105       <Private>False</Private>
    106     </Reference>
    107104    <Reference Include="System" />
    108     <Reference Include="System.Core">
    109       <RequiredTargetFramework>3.5</RequiredTargetFramework>
    110     </Reference>
     105    <Reference Include="System.Core" />
    111106    <Reference Include="System.Data" />
    112107    <Reference Include="System.Deployment" />
    113108    <Reference Include="System.Drawing" />
    114     <Reference Include="System.IdentityModel">
    115       <RequiredTargetFramework>3.0</RequiredTargetFramework>
    116     </Reference>
    117     <Reference Include="System.Runtime.Serialization">
    118       <RequiredTargetFramework>3.0</RequiredTargetFramework>
    119     </Reference>
    120     <Reference Include="System.ServiceModel">
    121       <RequiredTargetFramework>3.0</RequiredTargetFramework>
    122     </Reference>
     109    <Reference Include="System.IdentityModel" />
     110    <Reference Include="System.Runtime.Serialization" />
     111    <Reference Include="System.ServiceModel" />
    123112    <Reference Include="System.Windows.Forms" />
    124113    <Reference Include="System.Xml" />
     114    <Reference Include="ICSharpCode.SharpZipLib">
     115      <HintPath>ICSharpCode.SharpZipLib.dll</HintPath>
     116    </Reference>
    125117  </ItemGroup>
    126118  <ItemGroup>
     
    223215      <DependentUpon>PluginView.cs</DependentUpon>
    224216    </Compile>
     217    <Compile Include="ArgumentHandling\ArgumentHandling.cs" />
     218    <Compile Include="ArgumentHandling\Arguments.cs" />
     219    <Compile Include="ArgumentHandling\IArgument.cs" />
    225220    <Compile Include="Attributes\ApplicationAttribute.cs" />
    226221    <Compile Include="Attributes\ContactInformationAttribute.cs" />
     
    269264    <Compile Include="Main.cs" />
    270265    <Compile Include="Properties\AssemblyInfo.cs" />
     266    <Compile Include="TypeExtensions.cs" />
    271267    <None Include="Advanced\DeploymentService\GenerateServiceClients.cmd" />
    272268    <None Include="app.config">
     
    373369  -->
    374370  <PropertyGroup>
    375     <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     371    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    376372set ProjectDir=$(ProjectDir)
    377373set SolutionDir=$(SolutionDir)
     
    379375
    380376call PreBuildEvent.cmd</PreBuildEvent>
     377    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     378export ProjectDir=$(ProjectDir)
     379export SolutionDir=$(SolutionDir)
     380
     381$SolutionDir/PreBuildEvent.sh
     382</PreBuildEvent>
    381383  </PropertyGroup>
    382384</Project>
  • branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs

    r7662 r8660  
    7575      foreach (Type t in GetTypes(type)) {
    7676        object instance = null;
    77         try { instance = Activator.CreateInstance(t); } catch { }
     77        try { instance = Activator.CreateInstance(t); }
     78        catch { }
    7879        if (instance != null) instances.Add(instance);
    7980      }
     
    127128        var assemblyTypes = assembly.GetTypes();
    128129
    129         var buildTypes = from t in assembly.GetTypes()
    130                          where CheckTypeCompatibility(type, t)
    131                          where !IsNonDiscoverableType(t)
    132                          where onlyInstantiable == false ||
    133                                (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
    134                          select BuildType(t, type);
     130        var matchingTypes = from assemblyType in assembly.GetTypes()
     131                            let t = assemblyType.BuildType(type)
     132                            where t != null
     133                            where t.IsSubTypeOf(type)
     134                            where !t.IsNonDiscoverableType()
     135                            where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
     136                            where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
     137                            select t;
    135138
    136         return from t in buildTypes
    137                where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
    138                select t;
    139       } catch (TypeLoadException) {
    140         return Enumerable.Empty<Type>();
    141       } catch (ReflectionTypeLoadException) {
     139        return matchingTypes;
     140      }
     141      catch (TypeLoadException) {
    142142        return Enumerable.Empty<Type>();
    143143      }
    144     }
    145 
    146     private static bool IsNonDiscoverableType(Type t) {
    147       return t.GetCustomAttributes(typeof(NonDiscoverableTypeAttribute), false).Any();
    148     }
    149 
    150     private static bool CheckTypeCompatibility(Type type, Type other) {
    151       if (type.IsAssignableFrom(other))
    152         return true;
    153       if (type.IsGenericType && other.IsGenericType) {
    154         var otherGenericArguments = other.GetGenericArguments();
    155         var typeGenericArguments = type.GetGenericArguments();
    156 
    157         //check type arguments count
    158         if (otherGenericArguments.Length != typeGenericArguments.Length)
    159           return false;
    160 
    161         //check type arguments & constraints
    162         int i = 0;
    163         foreach (var genericArgument in typeGenericArguments) {
    164           if (otherGenericArguments[i].IsGenericParameter) {
    165             foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints())
    166               if (!constraint.IsAssignableFrom(genericArgument)) return false;
    167           } else if (genericArgument != otherGenericArguments[i]) return false;
    168           i++;
    169         }
    170         //check types
    171         try {
    172           var otherGenericTypeDefinition = other.GetGenericTypeDefinition();
    173           if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments)))
    174             return true;
    175         } catch (Exception) { }
     144      catch (ReflectionTypeLoadException) {
     145        return Enumerable.Empty<Type>();
    176146      }
    177       return false;
    178     }
    179     private static Type BuildType(Type type, Type protoType) {
    180       if (type.IsGenericType && protoType.IsGenericType)
    181         return type.GetGenericTypeDefinition().MakeGenericType(protoType.GetGenericArguments());
    182       else
    183         return type;
    184147    }
    185148
  • branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/Main.cs

    r7259 r8660  
    3434    /// <param name="args">Command line arguments</param>
    3535    public static void Run(string[] args) {
    36       if (!FrameworkVersionErrorDialog.NET4FullProfileInstalled) {
     36      if ((!FrameworkVersionErrorDialog.NET4FullProfileInstalled && !FrameworkVersionErrorDialog.MonoInstalled)
     37        || (FrameworkVersionErrorDialog.MonoInstalled && !FrameworkVersionErrorDialog.MonoCorrectVersionInstalled)) {
    3738        Application.EnableVisualStyles();
    3839        Application.SetCompatibleTextRenderingDefault(false);
     
    4243          Application.EnableVisualStyles();
    4344          Application.SetCompatibleTextRenderingDefault(false);
    44           Application.Run(new StarterForm());
     45          Application.Run(new StarterForm(args));
    4546        }
    4647        catch (Exception ex) {
  • branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/Properties/AssemblyInfo.cs.frame

    r7259 r8660  
    5656//
    5757[assembly: AssemblyVersion("3.3.0.0")]
    58 [assembly: AssemblyFileVersion("3.3.6.$WCREV$")]
     58[assembly: AssemblyFileVersion("3.3.7.$WCREV$")]
  • branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/Resources.resx

    r6413 r8660  
    123123  </data>
    124124  <data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
    125     <value>Resources\vs2008imagelibrary_commonelements_objects_arrow_up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     125    <value>Resources\VS2008ImageLibrary_CommonElements_Objects_Arrow_Up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    126126  </data>
    127127  <data name="Assembly" type="System.Resources.ResXFileRef, System.Windows.Forms">
    128     <value>Resources\vs2008imagelibrary_objects_assembly.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     128    <value>Resources\VS2008ImageLibrary_Objects_Assembly.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    129129  </data>
    130130  <data name="Document" type="System.Resources.ResXFileRef, System.Windows.Forms">
     
    150150  </data>
    151151  <data name="Install" type="System.Resources.ResXFileRef, System.Windows.Forms">
    152     <value>Resources\vs2008imagelibrary_objects_install.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     152    <value>Resources\VS2008ImageLibrary_Objects_Install.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    153153  </data>
    154154  <data name="Internet" type="System.Resources.ResXFileRef, System.Windows.Forms">
     
    195195  </data>
    196196  <data name="UpdateAvailable" type="System.Resources.ResXFileRef, System.Windows.Forms">
    197     <value>resources\updateavailable.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     197    <value>Resources\UpdateAvailable.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    198198  </data>
    199199</root>
  • branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/SandboxApplicationManager.cs

    r7586 r8660  
    261261    /// <returns>Enumerable of the discovered types.</returns>
    262262    private static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable, bool includeGenericTypeDefinitions) {
    263       var buildTypes = from t in assembly.GetTypes()
    264                        where CheckTypeCompatibility(type, t)
    265                        where !IsNonDiscoverableType(t)
    266                        where onlyInstantiable == false ||
    267                              (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
    268                        select BuildType(t, type);
    269 
    270       return from t in buildTypes
    271              where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
    272              select t;
    273     }
    274 
    275 
    276     private static bool IsNonDiscoverableType(Type t) {
    277       return t.GetCustomAttributes(typeof(NonDiscoverableTypeAttribute), false).Any();
    278     }
    279 
    280     private static bool CheckTypeCompatibility(Type type, Type other) {
    281       if (type.IsAssignableFrom(other))
    282         return true;
    283       if (type.IsGenericType && other.IsGenericType) {
    284         var otherGenericArguments = other.GetGenericArguments();
    285         var typeGenericArguments = type.GetGenericArguments();
    286 
    287         //check type arguments count
    288         if (otherGenericArguments.Length != typeGenericArguments.Length)
    289           return false;
    290 
    291         //check type arguments & constraints
    292         int i = 0;
    293         foreach (var genericArgument in typeGenericArguments) {
    294           if (otherGenericArguments[i].IsGenericParameter) {
    295             foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints())
    296               if (!constraint.IsAssignableFrom(genericArgument)) return false;
    297           } else if (genericArgument != otherGenericArguments[i]) return false;
    298           i++;
    299         }
    300         //check types
    301         try {
    302           var otherGenericTypeDefinition = other.GetGenericTypeDefinition();
    303           if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments)))
    304             return true;
    305         }
    306         catch (Exception) { }
    307       }
    308       return false;
    309     }
    310     private static Type BuildType(Type type, Type protoType) {
    311       if (type.IsGenericType && protoType.IsGenericType)
    312         return type.GetGenericTypeDefinition().MakeGenericType(protoType.GetGenericArguments());
    313       else
    314         return type;
     263      var matchingTypes = from assemblyType in assembly.GetTypes()
     264                          let t = assemblyType.BuildType(type)
     265                          where t != null
     266                          where t.IsSubTypeOf(type)
     267                          where !t.IsNonDiscoverableType()
     268                          where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
     269                          where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
     270                          select t;
     271
     272      return matchingTypes;
    315273    }
    316274
  • branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.Designer.cs

    r8085 r8660  
    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
  • branches/GP-MoveOperators/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.cs

    r7259 r8660  
    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.