mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Use root node when creating new connection/folder and no node is selected
This commit is contained in:
@@ -204,11 +204,12 @@ namespace mRemoteNG.UI.Controls
|
||||
|
||||
private void AddNode(ConnectionInfo newNode)
|
||||
{
|
||||
if (SelectedNode == null) return;
|
||||
// use root node if no node is selected
|
||||
ConnectionInfo parentNode = (SelectedNode == null) ? Roots.Cast<ConnectionInfo>().First(item => item is RootNodeInfo) : SelectedNode;
|
||||
DefaultConnectionInfo.Instance.SaveTo(newNode);
|
||||
DefaultConnectionInheritance.Instance.SaveTo(newNode.Inheritance);
|
||||
var selectedContainer = SelectedNode as ContainerInfo;
|
||||
var parent = selectedContainer ?? SelectedNode?.Parent;
|
||||
var selectedContainer = parentNode as ContainerInfo;
|
||||
var parent = selectedContainer ?? parentNode?.Parent;
|
||||
newNode.SetParent(parent);
|
||||
Expand(parent);
|
||||
SelectObject(newNode, true);
|
||||
|
||||
Reference in New Issue
Block a user