private void nodeClick(MouseEventArgs e, ITreeNode selectedNode) { var showingPopup = e.Button == MouseButtons.Right; var previouslySelectedNode = selectedNodes; var canClearSelection = previouslySelectedNode.Count == 1 || !showingPopup; //this call may reset the current selection of node manageSelectedNodes(selectedNode, canClearSelection); if (!showingPopup) { return; } var currentlySelectedNode = selectedNodes; if (currentlySelectedNode.Count > 1) { _presenter.CreatePopupMenuFor(currentlySelectedNode).At(e.Location); } else { _presenter.CreatePopupMenuFor(selectedNode).At(e.Location); } }