mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-26 03:58:45 +08:00
Fixed bug where loading a new connection file or creating a new one would not update the connection tree
This commit is contained in:
@@ -228,12 +228,10 @@ namespace mRemoteNG.App
|
||||
|
||||
}
|
||||
|
||||
var rootConnectionNode = ConnectionTreeModel.RootNodes.First(node => !(node is RootPuttySessionsNodeInfo));
|
||||
ConnectionTreeModel.RemoveRootNode(rootConnectionNode);
|
||||
|
||||
// Load config
|
||||
connectionsLoader.ConnectionFileName = filename;
|
||||
connectionsLoader.LoadConnections(false);
|
||||
ConnectionTreeModel = connectionsLoader.LoadConnections(false);
|
||||
Windows.TreeForm.ConnectionTreeModel = ConnectionTreeModel;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -270,7 +268,7 @@ namespace mRemoteNG.App
|
||||
{
|
||||
if (withDialog)
|
||||
{
|
||||
var loadDialog = Tools.Controls.ConnectionsLoadDialog();
|
||||
var loadDialog = Controls.ConnectionsLoadDialog();
|
||||
if (loadDialog.ShowDialog() != DialogResult.OK) return;
|
||||
connectionsLoader.ConnectionFileName = loadDialog.FileName;
|
||||
}
|
||||
@@ -283,7 +281,8 @@ namespace mRemoteNG.App
|
||||
}
|
||||
|
||||
connectionsLoader.UseDatabase = Settings.Default.UseSQLServer;
|
||||
connectionsLoader.LoadConnections(false);
|
||||
ConnectionTreeModel = connectionsLoader.LoadConnections(false);
|
||||
Windows.TreeForm.ConnectionTreeModel = ConnectionTreeModel;
|
||||
|
||||
if (Settings.Default.UseSQLServer)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using mRemoteNG.Config.DatabaseConnectors;
|
||||
using mRemoteNG.Config.DataProviders;
|
||||
using mRemoteNG.Config.Putty;
|
||||
using mRemoteNG.Config.Serializers;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.UI.Forms;
|
||||
|
||||
|
||||
@@ -14,7 +15,7 @@ namespace mRemoteNG.Config.Connections
|
||||
public string ConnectionFileName { get; set; }
|
||||
|
||||
|
||||
public void LoadConnections(bool import)
|
||||
public ConnectionTreeModel LoadConnections(bool import)
|
||||
{
|
||||
IDeserializer deserializer;
|
||||
if (UseDatabase)
|
||||
@@ -32,14 +33,15 @@ namespace mRemoteNG.Config.Connections
|
||||
}
|
||||
|
||||
var connectionTreeModel = deserializer.Deserialize();
|
||||
Runtime.ConnectionTreeModel = connectionTreeModel;
|
||||
|
||||
frmMain.Default.AreWeUsingSqlServerForSavingConnections = UseDatabase;
|
||||
frmMain.Default.ConnectionsFileName = ConnectionFileName;
|
||||
|
||||
if (import) return;
|
||||
if (import) return connectionTreeModel;
|
||||
PuttySessionsManager.Instance.AddSessions();
|
||||
Runtime.ConnectionTreeModel.RootNodes.AddRange(PuttySessionsManager.Instance.RootPuttySessionsNodes);
|
||||
connectionTreeModel.RootNodes.AddRange(PuttySessionsManager.Instance.RootPuttySessionsNodes);
|
||||
|
||||
return connectionTreeModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,6 @@ namespace mRemoteNG.UI.Forms
|
||||
Opacity = 1;
|
||||
|
||||
ConnectionTreeWindow = Windows.TreeForm;
|
||||
ConnectionTreeWindow.ConnectionTreeModel = Runtime.ConnectionTreeModel;
|
||||
}
|
||||
|
||||
private void ApplySpecialSettingsForPortableVersion()
|
||||
|
||||
Reference in New Issue
Block a user