Fix proposal for issue 'Can not add new connection or new folder'
This commit is contained in:
Sean Kaim
2017-09-09 15:34:44 -04:00
committed by GitHub

View File

@@ -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);