From f3d0b1f30226baefa79841a28486255bf5cf4677 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Mon, 20 Sep 2021 09:34:13 +0100 Subject: [PATCH] CP-36392: Rename _selectedNodes to _internalSelectedNodes To avoid getter naming confusion Also rename `_seletedNodesWrapper` to `_selectedNodes` Signed-off-by: Danilo Del Busso --- .../MultiSelectTreeSelectedNodeCollection.cs | 14 +++++----- .../Controls/TreeViews/MultiSelectTreeView.cs | 28 ++++++++----------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/XenAdmin/Controls/TreeViews/MultiSelectTreeSelectedNodeCollection.cs b/XenAdmin/Controls/TreeViews/MultiSelectTreeSelectedNodeCollection.cs index 162c0c52d..eec3552c0 100644 --- a/XenAdmin/Controls/TreeViews/MultiSelectTreeSelectedNodeCollection.cs +++ b/XenAdmin/Controls/TreeViews/MultiSelectTreeSelectedNodeCollection.cs @@ -96,7 +96,7 @@ namespace XenAdmin.Controls public int IndexOf(MultiSelectTreeNode item) { - return _parent._selectedNodes.IndexOf(item); + return _parent._internalSelectedNodes.IndexOf(item); } public void Insert(int index, MultiSelectTreeNode item) @@ -108,7 +108,7 @@ namespace XenAdmin.Controls public void RemoveAt(int index) { - MultiSelectTreeNode item = _parent._selectedNodes[index]; + MultiSelectTreeNode item = _parent._internalSelectedNodes[index]; _parent._selectionChanged = false; _parent.SelectNode(item, false, TreeViewAction.Unknown); _parent.OnSelectionsChanged(); @@ -118,7 +118,7 @@ namespace XenAdmin.Controls { get { - return _parent._selectedNodes[index]; + return _parent._internalSelectedNodes[index]; } set { @@ -146,17 +146,17 @@ namespace XenAdmin.Controls public bool Contains(MultiSelectTreeNode item) { - return _parent._selectedNodes.Contains(item); + return _parent._internalSelectedNodes.Contains(item); } public void CopyTo(MultiSelectTreeNode[] array, int arrayIndex) { - _parent._selectedNodes.CopyTo(array, arrayIndex); + _parent._internalSelectedNodes.CopyTo(array, arrayIndex); } public int Count { - get { return _parent._selectedNodes.Count; } + get { return _parent._internalSelectedNodes.Count; } } public bool IsReadOnly @@ -179,7 +179,7 @@ namespace XenAdmin.Controls public IEnumerator GetEnumerator() { - return _parent._selectedNodes.GetEnumerator(); + return _parent._internalSelectedNodes.GetEnumerator(); } #endregion diff --git a/XenAdmin/Controls/TreeViews/MultiSelectTreeView.cs b/XenAdmin/Controls/TreeViews/MultiSelectTreeView.cs index d453dd4a2..b8ff32cb7 100644 --- a/XenAdmin/Controls/TreeViews/MultiSelectTreeView.cs +++ b/XenAdmin/Controls/TreeViews/MultiSelectTreeView.cs @@ -64,8 +64,8 @@ namespace XenAdmin.Controls private bool _nodeProcessedOnMouseDown; private bool _selectionChanged; private bool _wasDoubleClick; - private readonly InternalSelectedNodeCollection _selectedNodes = new InternalSelectedNodeCollection(); - private readonly MultiSelectTreeSelectedNodeCollection _selectedNodesWrapper; + private readonly InternalSelectedNodeCollection _internalSelectedNodes = new InternalSelectedNodeCollection(); + private readonly MultiSelectTreeSelectedNodeCollection _selectedNodes; private int intMouseClicks; private TreeViewSelectionMode _selectionMode; private MultiSelectTreeNode _keysStartNode; @@ -84,7 +84,7 @@ namespace XenAdmin.Controls public MultiSelectTreeView() { - _selectedNodesWrapper = new MultiSelectTreeSelectedNodeCollection(this); + _selectedNodes = new MultiSelectTreeSelectedNodeCollection(this); _nodes = new MultiSelectTreeNodeCollection(this); } @@ -185,7 +185,7 @@ namespace XenAdmin.Controls private bool IsNodeSelected(MultiSelectTreeNode node) { - return node != null && _selectedNodes.Contains(node); + return node != null && _internalSelectedNodes.Contains(node); } private bool IsPlusMinusClicked(MultiSelectTreeNode node, MouseEventArgs e) @@ -826,7 +826,7 @@ namespace XenAdmin.Controls { return false; } - _selectedNodes.Add(node); + _internalSelectedNodes.Add(node); selected = true; _selectionChanged = true; OnAfterSelect(new TreeViewEventArgs(node, tva)); @@ -837,7 +837,7 @@ namespace XenAdmin.Controls if (IsNodeSelected(node)) { OnBeforeDeselect(new TreeViewEventArgs(node)); - _selectedNodes.Remove(node); + _internalSelectedNodes.Remove(node); _selectionChanged = true; OnAfterDeselect(new TreeViewEventArgs(node)); @@ -898,7 +898,7 @@ namespace XenAdmin.Controls { List list = new List(); - foreach (MultiSelectTreeNode node in _selectedNodes) + foreach (MultiSelectTreeNode node in _internalSelectedNodes) { if (nodeKeepSelected == null) { @@ -918,7 +918,7 @@ namespace XenAdmin.Controls private void UnselectAllNodesNotBelongingDirectlyToParent(MultiSelectTreeNode parent, TreeViewAction tva) { ArrayList list = new ArrayList(); - foreach (MultiSelectTreeNode node in _selectedNodes) + foreach (MultiSelectTreeNode node in _internalSelectedNodes) { if (node.Parent != parent) { @@ -934,7 +934,7 @@ namespace XenAdmin.Controls private void UnselectAllNodesNotBelongingToLevel(int level, TreeViewAction tva) { ArrayList list = new ArrayList(); - foreach (MultiSelectTreeNode node in _selectedNodes) + foreach (MultiSelectTreeNode node in _internalSelectedNodes) { if (GetNodeLevel(node) != level) { @@ -950,7 +950,7 @@ namespace XenAdmin.Controls private void UnselectAllNodesNotBelongingToParent(MultiSelectTreeNode parent, TreeViewAction tva) { ArrayList list = new ArrayList(); - foreach (MultiSelectTreeNode node in _selectedNodes) + foreach (MultiSelectTreeNode node in _internalSelectedNodes) { if (!IsChildOf(node, parent)) { @@ -1043,13 +1043,7 @@ namespace XenAdmin.Controls } } - public MultiSelectTreeSelectedNodeCollection SelectedNodes - { - get - { - return _selectedNodesWrapper; - } - } + public MultiSelectTreeSelectedNodeCollection SelectedNodes => _selectedNodes; [DefaultValue(TreeViewSelectionMode.SingleSelect)] public TreeViewSelectionMode SelectionMode