Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15316


Ignore:
Timestamp:
08/09/17 18:39:05 (7 years ago)
Author:
abeham
Message:

#2814: merged to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Optimizer

  • stable/HeuristicLab.Optimizer/3.3/MenuItems/ChangeNestingLevelMenuItem.cs

    r15038 r15316  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    2423using System.Windows.Forms;
    2524using HeuristicLab.MainForm;
    26 using Microsoft.Win32;
    2725
    2826namespace HeuristicLab.Optimizer.MenuItems {
    2927  internal class ChangeNestingLevelMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
    30 
    31     #region Creators Update Nesting
    32     const string VersionSubKey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
    33     private const int VersionWin10CreatorsUpdate = 460798;
    34     private const int RecommendedMaxNestingLevel = 25;
    35 
    36     static ChangeNestingLevelMenuItem() {
    37       var settings = HeuristicLab.Core.Views.Properties.Settings.Default;
    38       try {
    39         // detect installed .net/OS version https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx#net_d
    40         using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(VersionSubKey)) {
    41           if (ndpKey == null || ndpKey.GetValue("Release") == null) return;
    42           int version = (int)ndpKey.GetValue("Release");
    43           if (version == VersionWin10CreatorsUpdate && settings.MaximumNestedControls > RecommendedMaxNestingLevel) {
    44             var message = string.Format("A high nesting level of controls can cause Windows 10 Creators Update to crash with a blue screen. "
    45                                           + "Do you want to set the maximum nesting level from {0} to {1} to minimize the risk of a crash?",
    46                 settings.MaximumNestedControls, RecommendedMaxNestingLevel);
    47             if (MessageBox.Show(message, "Reduce Maximum Nesting Level?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) {
    48               settings.MaximumNestedControls = 25;
    49               settings.Save();
    50             }
    51           }
    52         }
    53       } catch (PlatformNotSupportedException) {
    54         // thrown on mono
    55       }
    56     }
    57     #endregion
    58 
    5928    public override string Name {
    6029      get { return "Change &Nesting Level..."; }
Note: See TracChangeset for help on using the changeset viewer.