mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
moved property from Runtime to ConnectionsService
This commit is contained in:
@@ -42,11 +42,6 @@ namespace mRemoteNG.App
|
||||
private static DateTime LastSqlUpdate { get; set; }
|
||||
public static ExternalToolsService ExternalToolsService { get; } = new ExternalToolsService();
|
||||
public static SecureString EncryptionKey { get; set; } = new RootNodeInfo(RootNodeType.Connection).PasswordString.ConvertToSecureString();
|
||||
public static ConnectionTreeModel ConnectionTreeModel
|
||||
{
|
||||
get { return Windows.TreeForm.ConnectionTree.ConnectionTreeModel; }
|
||||
set { Windows.TreeForm.ConnectionTree.ConnectionTreeModel = value; }
|
||||
}
|
||||
public static ICredentialRepositoryList CredentialProviderCatalog { get; } = new CredentialRepositoryList();
|
||||
public static ConnectionsService ConnectionsService { get; } = new ConnectionsService();
|
||||
#endregion
|
||||
@@ -92,8 +87,8 @@ namespace mRemoteNG.App
|
||||
}
|
||||
|
||||
connectionsLoader.UseDatabase = Settings.Default.UseSQLServer;
|
||||
ConnectionTreeModel = connectionsLoader.LoadConnections(CredentialProviderCatalog.GetCredentialRecords(), false);
|
||||
Windows.TreeForm.ConnectionTree.ConnectionTreeModel = ConnectionTreeModel;
|
||||
ConnectionsService.ConnectionTreeModel = connectionsLoader.LoadConnections(CredentialProviderCatalog.GetCredentialRecords(), false);
|
||||
Windows.TreeForm.ConnectionTree.ConnectionTreeModel = ConnectionsService.ConnectionTreeModel;
|
||||
|
||||
if (Settings.Default.UseSQLServer)
|
||||
{
|
||||
@@ -227,7 +222,7 @@ namespace mRemoteNG.App
|
||||
|
||||
public static void SaveConnections()
|
||||
{
|
||||
if (ConnectionTreeModel == null) return;
|
||||
if (ConnectionsService.ConnectionTreeModel == null) return;
|
||||
if (!ConnectionsService.IsConnectionsFileLoaded) return;
|
||||
|
||||
try
|
||||
@@ -240,7 +235,7 @@ namespace mRemoteNG.App
|
||||
connectionsSaver.ConnectionFileName = ConnectionsService.GetStartupConnectionFileName();
|
||||
|
||||
connectionsSaver.SaveFilter = new SaveFilter();
|
||||
connectionsSaver.ConnectionTreeModel = ConnectionTreeModel;
|
||||
connectionsSaver.ConnectionTreeModel = ConnectionsService.ConnectionTreeModel;
|
||||
|
||||
if (Settings.Default.UseSQLServer)
|
||||
{
|
||||
@@ -288,7 +283,7 @@ namespace mRemoteNG.App
|
||||
connectionsSave.SaveFormat = ConnectionsSaver.Format.mRXML;
|
||||
connectionsSave.ConnectionFileName = saveFileDialog.FileName;
|
||||
connectionsSave.SaveFilter = new SaveFilter();
|
||||
connectionsSave.ConnectionTreeModel = ConnectionTreeModel;
|
||||
connectionsSave.ConnectionTreeModel = ConnectionsService.ConnectionTreeModel;
|
||||
|
||||
connectionsSave.SaveConnections();
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace mRemoteNG.Config.Connections
|
||||
return;
|
||||
}
|
||||
|
||||
var rootTreeNode = Runtime.ConnectionTreeModel.RootNodes.OfType<RootNodeInfo>().First();
|
||||
var rootTreeNode = Runtime.ConnectionsService.ConnectionTreeModel.RootNodes.OfType<RootNodeInfo>().First();
|
||||
|
||||
UpdateRootNodeTable(rootTreeNode, sqlConnector);
|
||||
UpdateConnectionsTable(rootTreeNode, sqlConnector);
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace mRemoteNG.Config.Connections.Multiuser
|
||||
|
||||
public void Load()
|
||||
{
|
||||
Runtime.ConnectionTreeModel = _connectionsLoader.LoadConnections(Runtime.CredentialProviderCatalog.GetCredentialRecords(), false);
|
||||
Runtime.ConnectionsService.ConnectionTreeModel = _connectionsLoader.LoadConnections(Runtime.CredentialProviderCatalog.GetCredentialRecords(), false);
|
||||
}
|
||||
|
||||
private void Load(object sender, ConnectionsUpdateAvailableEventArgs args)
|
||||
|
||||
@@ -13,6 +13,12 @@ namespace mRemoteNG.Connection
|
||||
{
|
||||
public bool IsConnectionsFileLoaded { get; set; }
|
||||
|
||||
public ConnectionTreeModel ConnectionTreeModel
|
||||
{
|
||||
get { return Windows.TreeForm.ConnectionTree.ConnectionTreeModel; }
|
||||
set { Windows.TreeForm.ConnectionTree.ConnectionTreeModel = value; }
|
||||
}
|
||||
|
||||
public void NewConnections(string filename)
|
||||
{
|
||||
try
|
||||
@@ -30,8 +36,8 @@ namespace mRemoteNG.Connection
|
||||
|
||||
// Load config
|
||||
var connectionsLoader = new ConnectionsLoader { ConnectionFileName = filename };
|
||||
Runtime.ConnectionTreeModel = connectionsLoader.LoadConnections(Runtime.CredentialProviderCatalog.GetCredentialRecords(), false);
|
||||
Windows.TreeForm.ConnectionTree.ConnectionTreeModel = Runtime.ConnectionTreeModel;
|
||||
ConnectionTreeModel = connectionsLoader.LoadConnections(Runtime.CredentialProviderCatalog.GetCredentialRecords(), false);
|
||||
Windows.TreeForm.ConnectionTree.ConnectionTreeModel = ConnectionTreeModel;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace mRemoteNG.Tools
|
||||
};
|
||||
|
||||
// ReSharper disable once CoVariantArrayConversion
|
||||
ToolStripItem[] rootMenuItems = menuItemsConverter.CreateToolStripDropDownItems(Runtime.ConnectionTreeModel).ToArray();
|
||||
ToolStripItem[] rootMenuItems = menuItemsConverter.CreateToolStripDropDownItems(Runtime.ConnectionsService.ConnectionTreeModel).ToArray();
|
||||
_cMenCons.DropDownItems.AddRange(rootMenuItems);
|
||||
}
|
||||
|
||||
|
||||
@@ -719,7 +719,7 @@ namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
ContainerInfo selectedNodeAsContainer;
|
||||
if (_connectionTree.SelectedNode == null)
|
||||
selectedNodeAsContainer = Runtime.ConnectionTreeModel.RootNodes.First();
|
||||
selectedNodeAsContainer = Runtime.ConnectionsService.ConnectionTreeModel.RootNodes.First();
|
||||
else
|
||||
selectedNodeAsContainer = _connectionTree.SelectedNode as ContainerInfo ?? _connectionTree.SelectedNode.Parent;
|
||||
Import.ImportFromFile(selectedNodeAsContainer);
|
||||
@@ -737,7 +737,7 @@ namespace mRemoteNG.UI.Controls
|
||||
|
||||
private void OnExportFileClicked(object sender, EventArgs e)
|
||||
{
|
||||
Export.ExportToFile(_connectionTree.SelectedNode, Runtime.ConnectionTreeModel);
|
||||
Export.ExportToFile(_connectionTree.SelectedNode, Runtime.ConnectionsService.ConnectionTreeModel);
|
||||
}
|
||||
|
||||
private void OnAddConnectionClicked(object sender, EventArgs e)
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace mRemoteNG.UI.Controls
|
||||
};
|
||||
|
||||
// ReSharper disable once CoVariantArrayConversion
|
||||
ToolStripItem[] rootMenuItems = menuItemsConverter.CreateToolStripDropDownItems(Runtime.ConnectionTreeModel).ToArray();
|
||||
ToolStripItem[] rootMenuItems = menuItemsConverter.CreateToolStripDropDownItems(Runtime.ConnectionsService.ConnectionTreeModel).ToArray();
|
||||
_btnConnections.DropDownItems.AddRange(rootMenuItems);
|
||||
}
|
||||
|
||||
|
||||
@@ -432,7 +432,7 @@ namespace mRemoteNG.UI.Menu
|
||||
var selectedNode = TreeWindow.SelectedNode;
|
||||
ContainerInfo importDestination;
|
||||
if (selectedNode == null)
|
||||
importDestination = Runtime.ConnectionTreeModel.RootNodes.First();
|
||||
importDestination = Runtime.ConnectionsService.ConnectionTreeModel.RootNodes.First();
|
||||
else
|
||||
importDestination = selectedNode as ContainerInfo ?? selectedNode.Parent;
|
||||
Import.ImportFromFile(importDestination);
|
||||
@@ -450,7 +450,7 @@ namespace mRemoteNG.UI.Menu
|
||||
|
||||
private void mMenFileExport_Click(object sender, EventArgs e)
|
||||
{
|
||||
Export.ExportToFile(Windows.TreeForm.SelectedNode, Runtime.ConnectionTreeModel);
|
||||
Export.ExportToFile(Windows.TreeForm.SelectedNode, Runtime.ConnectionsService.ConnectionTreeModel);
|
||||
}
|
||||
|
||||
private void mMenFileExit_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace mRemoteNG.UI.Window
|
||||
if (selectedNode != null)
|
||||
importDestination = selectedNode as ContainerInfo ?? selectedNode.Parent;
|
||||
else
|
||||
importDestination = Runtime.ConnectionTreeModel.RootNodes.First();
|
||||
importDestination = Runtime.ConnectionsService.ConnectionTreeModel.RootNodes.First();
|
||||
|
||||
Import.ImportFromActiveDirectory(ActiveDirectoryTree.ADPath, importDestination, chkSubOU.Checked);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user