Refactored the single node click event handler to handle the CellClick event instead of MouseClick to be more in line with the double click event handler

This commit is contained in:
David Sparer
2016-09-08 08:24:01 -06:00
parent 4ca07d534b
commit 08466f5179

View File

@@ -95,7 +95,7 @@ namespace mRemoteNG.UI.Window
olvConnections.BeforeLabelEdit += tvConnections_BeforeLabelEdit;
olvConnections.AfterLabelEdit += tvConnections_AfterLabelEdit;
olvConnections.SelectionChanged += tvConnections_AfterSelect;
olvConnections.MouseClick += tvConnections_NodeMouseClick;
olvConnections.CellClick += tvConnections_NodeMouseSingleClick;
olvConnections.CellClick += tvConnections_NodeMouseDoubleClick;
}
@@ -250,23 +250,21 @@ namespace mRemoteNG.UI.Window
}
}
private void tvConnections_NodeMouseClick(object sender, MouseEventArgs e)
private void tvConnections_NodeMouseSingleClick(object sender, CellClickEventArgs e)
{
try
{
if (e.ClickCount > 1) return;
var clickedNode = (ConnectionInfo)e.Model;
ShowHideTreeContextMenuItems(SelectedNode);
if (e.Button != MouseButtons.Left) return;
if (Settings.Default.SingleClickOnConnectionOpensIt &&
(SelectedNode.GetTreeNodeType() == TreeNodeType.Connection | SelectedNode.GetTreeNodeType() == TreeNodeType.PuttySession))
{
//if (e.Button != MouseButtons.Left) return;
if (clickedNode.GetTreeNodeType() != TreeNodeType.Connection && clickedNode.GetTreeNodeType() != TreeNodeType.PuttySession) return;
if (Settings.Default.SingleClickOnConnectionOpensIt)
Runtime.OpenConnection();
}
if (Settings.Default.SingleClickSwitchesToOpenConnection && SelectedNode.GetTreeNodeType() == TreeNodeType.Connection)
{
if (Settings.Default.SingleClickSwitchesToOpenConnection)
Runtime.SwitchToOpenConnection(SelectedNode);
}
}
catch (Exception ex)
{