Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/07/17 10:34:08 (7 years ago)
Author:
gkronber
Message:

#2695: merged r15299:15302 from trunk to branch

Location:
branches/dataset-ids-2695
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/dataset-ids-2695

  • branches/dataset-ids-2695/HeuristicLab.Optimizer

  • branches/dataset-ids-2695/HeuristicLab.Optimizer/3.3/MenuItems/ChangeNestingLevelMenuItem.cs

    r15003 r15310  
    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.