diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 2a3df1a9..2659e23d 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/SunnyUI/Controls/UINavBar.cs b/SunnyUI/Controls/UINavBar.cs index 72bacf68..7c05543e 100644 --- a/SunnyUI/Controls/UINavBar.cs +++ b/SunnyUI/Controls/UINavBar.cs @@ -56,6 +56,12 @@ namespace Sunny.UI Version = UIGlobal.Version; } + public void ClearAll() + { + Nodes.Clear(); + MenuHelper.Clear(); + } + protected override void OnFontChanged(EventArgs e) { base.OnFontChanged(e); diff --git a/SunnyUI/Controls/UINavMenu.cs b/SunnyUI/Controls/UINavMenu.cs index b14ca070..3d22aad5 100644 --- a/SunnyUI/Controls/UINavMenu.cs +++ b/SunnyUI/Controls/UINavMenu.cs @@ -87,6 +87,12 @@ namespace Sunny.UI [Description("获取或设置包含有关控件的数据的对象字符串"), Category("SunnyUI")] public string TagString { get; set; } + public void ClearAll() + { + Nodes.Clear(); + MenuHelper.Clear(); + } + protected override void OnBackColorChanged(EventArgs e) { base.OnBackColorChanged(e); diff --git a/SunnyUI/Controls/UINavMenuHelper.cs b/SunnyUI/Controls/UINavMenuHelper.cs index 576e7ec8..9c8f4f8c 100644 --- a/SunnyUI/Controls/UINavMenuHelper.cs +++ b/SunnyUI/Controls/UINavMenuHelper.cs @@ -41,6 +41,11 @@ namespace Sunny.UI } } + public void Clear() + { + Items.Clear(); + } + private readonly ConcurrentDictionary Items = new ConcurrentDictionary(); public string GetTipsText(TreeNode node) diff --git a/SunnyUI/Static/USystem.cs b/SunnyUI/Static/USystem.cs index e103054d..bbe9ee23 100644 --- a/SunnyUI/Static/USystem.cs +++ b/SunnyUI/Static/USystem.cs @@ -51,19 +51,32 @@ namespace Sunny.UI public static void EnabledTaskManager() { - DisableTaskMgrRegistryKey(true); + RegistryDisableTaskMgr(0); } public static void DisabledTaskManager() { - DisableTaskMgrRegistryKey(false); + RegistryDisableTaskMgr(1); } - private static void DisableTaskMgrRegistryKey(bool enabled) + public static void RegistryDisableTaskMgr(int value) { string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; RegistryKey mKey = Registry.CurrentUser.CreateSubKey(subKey); - mKey?.SetValue("DisableTaskMgr", enabled ? 0 : 1); + mKey?.SetValue("DisableTaskMgr", value); + mKey?.Dispose(); + } + + public static void RegistryHooksTimeout() + { + string subKey = @"Control Panel\Desktop"; + RegistryKey mKey = Registry.CurrentUser.CreateSubKey(subKey); + mKey?.SetValue("LowLevelHooksTimeout", 10000); + mKey?.Dispose(); + + subKey = @".DEFAULT\Control Panel\Desktop"; + mKey = Registry.Users.CreateSubKey(subKey); + mKey?.SetValue("LowLevelHooksTimeout", 10000); mKey?.Dispose(); }