Changeset 15300
- Timestamp:
- 07/31/17 15:25:09 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimizer/3.3/MenuItems/ChangeNestingLevelMenuItem.cs
r15003 r15300 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Windows.Forms; 25 24 using HeuristicLab.MainForm; 26 using Microsoft.Win32;27 25 28 26 namespace HeuristicLab.Optimizer.MenuItems { 29 27 internal class ChangeNestingLevelMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 30 31 #region Creators Update Nesting32 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_d40 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 mono55 }56 }57 #endregion58 59 28 public override string Name { 60 29 get { return "Change &Nesting Level..."; }
Note: See TracChangeset
for help on using the changeset viewer.