Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/11/12 14:39:23 (12 years ago)
Author:
ascheibe
Message:

#1937 added check for correct mono version

Location:
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling/FrameworkVersionErrorDialog.Designer.cs

    r7967 r8632  
    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}
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling/FrameworkVersionErrorDialog.cs

    r7259 r8632  
    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}
Note: See TracChangeset for help on using the changeset viewer.