private void AddFromParentMenu() { if (!SubShellTypeItem.CanAddMore(this)) { return; } using (ShellStoreDialog dlg = new ShellStoreDialog { ShellPath = this.ParentShellPath, IgnoredKeyNames = new List <string> { this.ParentKeyName } }) { if (dlg.ShowDialog() != DialogResult.OK) { return; } dlg.SelectedKeyNames.ForEach(keyName => { if (!SubShellTypeItem.CanAddMore(this)) { return; } string srcPath = $@"{dlg.ShellPath}\{keyName}"; string dstPath = ObjectPath.GetNewPathWithIndex($@"{ShellPath}\{keyName}", ObjectPath.PathType.Registry); RegistryEx.CopyTo(srcPath, dstPath); this.AddItem(new SubShellItem(this, dstPath)); }); } }
private void AddFromParentMenu() { if (!SubShellTypeItem.CanAddMore(this)) { return; } using (ShellStoreDialog dlg = new ShellStoreDialog()) { dlg.IsReference = false; dlg.ShellPath = this.ParentShellPath; dlg.Filter = new Func <string, bool>(itemName => !itemName.Equals(this.ParentKeyName, StringComparison.OrdinalIgnoreCase)); if (dlg.ShowDialog() != DialogResult.OK) { return; } foreach (string keyName in dlg.SelectedKeyNames) { if (!SubShellTypeItem.CanAddMore(this)) { return; } string srcPath = $@"{dlg.ShellPath}\{keyName}"; string dstPath = ObjectPath.GetNewPathWithIndex($@"{ShellPath}\{keyName}", ObjectPath.PathType.Registry); RegistryEx.CopyTo(srcPath, dstPath); this.AddItem(new SubShellItem(this, dstPath)); } } }