diff --git a/mRemoteV1/App/Runtime.cs b/mRemoteV1/App/Runtime.cs index 83bac9a23..cb8bda5a2 100644 --- a/mRemoteV1/App/Runtime.cs +++ b/mRemoteV1/App/Runtime.cs @@ -37,7 +37,6 @@ namespace mRemoteNG.App public static WindowList WindowList { get; set; } public static MessageCollector MessageCollector { get; } = new MessageCollector(); public static NotificationAreaIcon NotificationAreaIcon { get; set; } - public static bool IsConnectionsFileLoaded { get; set; } public static RemoteConnectionsSyncronizer RemoteConnectionsSyncronizer { get; set; } // ReSharper disable once UnusedAutoPropertyAccessor.Local private static DateTime LastSqlUpdate { get; set; } @@ -229,7 +228,7 @@ namespace mRemoteNG.App public static void SaveConnections() { if (ConnectionTreeModel == null) return; - if (!IsConnectionsFileLoaded) return; + if (!ConnectionsService.IsConnectionsFileLoaded) return; try { diff --git a/mRemoteV1/Config/Connections/ConnectionsSaver.cs b/mRemoteV1/Config/Connections/ConnectionsSaver.cs index b2bfda22f..2a706a0f1 100644 --- a/mRemoteV1/Config/Connections/ConnectionsSaver.cs +++ b/mRemoteV1/Config/Connections/ConnectionsSaver.cs @@ -198,7 +198,7 @@ namespace mRemoteNG.Config.Connections // .VRE files are for ASG-Remote Desktop (prevously visionapp Remote Desktop) private void SaveToVRE() { - if (Runtime.IsConnectionsFileLoaded == false) + if (Runtime.ConnectionsService.IsConnectionsFileLoaded == false) { return; } diff --git a/mRemoteV1/Config/Serializers/ConnectionSerializers/XmlConnectionsDeserializer.cs b/mRemoteV1/Config/Serializers/ConnectionSerializers/XmlConnectionsDeserializer.cs index 7d1ef3064..a229ec0d4 100644 --- a/mRemoteV1/Config/Serializers/ConnectionSerializers/XmlConnectionsDeserializer.cs +++ b/mRemoteV1/Config/Serializers/ConnectionSerializers/XmlConnectionsDeserializer.cs @@ -54,7 +54,7 @@ namespace mRemoteNG.Config.Serializers LoadXmlConnectionData(xml); ValidateConnectionFileVersion(); if (!import) - Runtime.IsConnectionsFileLoaded = false; + Runtime.ConnectionsService.IsConnectionsFileLoaded = false; var rootXmlElement = _xmlDocument.DocumentElement; InitializeRootNode(rootXmlElement); @@ -86,13 +86,13 @@ namespace mRemoteNG.Config.Serializers AddNodesFromXmlRecursive(_xmlDocument.DocumentElement, _rootNodeInfo); if (!import) - Runtime.IsConnectionsFileLoaded = true; + Runtime.ConnectionsService.IsConnectionsFileLoaded = true; return connectionTreeModel; } catch (Exception ex) { - Runtime.IsConnectionsFileLoaded = false; + Runtime.ConnectionsService.IsConnectionsFileLoaded = false; Runtime.MessageCollector.AddExceptionStackTrace(Language.strLoadFromXmlFailed, ex); throw; } diff --git a/mRemoteV1/Config/Serializers/DataTableDeserializer.cs b/mRemoteV1/Config/Serializers/DataTableDeserializer.cs index a71bfb95f..c7c220b01 100644 --- a/mRemoteV1/Config/Serializers/DataTableDeserializer.cs +++ b/mRemoteV1/Config/Serializers/DataTableDeserializer.cs @@ -21,7 +21,7 @@ namespace mRemoteNG.Config.Serializers { var connectionList = CreateNodesFromTable(table); var connectionTreeModel = CreateNodeHierarchy(connectionList, table); - Runtime.IsConnectionsFileLoaded = true; + Runtime.ConnectionsService.IsConnectionsFileLoaded = true; return connectionTreeModel; } diff --git a/mRemoteV1/Connection/ConnectionsService.cs b/mRemoteV1/Connection/ConnectionsService.cs index de6661296..6540d14dd 100644 --- a/mRemoteV1/Connection/ConnectionsService.cs +++ b/mRemoteV1/Connection/ConnectionsService.cs @@ -11,6 +11,8 @@ namespace mRemoteNG.Connection { public class ConnectionsService { + public bool IsConnectionsFileLoaded { get; set; } + public void NewConnections(string filename) { try diff --git a/mRemoteV1/UI/Forms/frmMain.cs b/mRemoteV1/UI/Forms/frmMain.cs index 025bcc9be..3656455e1 100644 --- a/mRemoteV1/UI/Forms/frmMain.cs +++ b/mRemoteV1/UI/Forms/frmMain.cs @@ -453,7 +453,7 @@ namespace mRemoteNG.UI.Forms var titleBuilder = new StringBuilder(Application.ProductName); const string separator = " - "; - if (Runtime.IsConnectionsFileLoaded) + if (Runtime.ConnectionsService.IsConnectionsFileLoaded) { if (AreWeUsingSqlServerForSavingConnections) { diff --git a/mRemoteV1/UI/Menu/MainFileMenu.cs b/mRemoteV1/UI/Menu/MainFileMenu.cs index 6807fcacb..043d9388f 100644 --- a/mRemoteV1/UI/Menu/MainFileMenu.cs +++ b/mRemoteV1/UI/Menu/MainFileMenu.cs @@ -351,7 +351,7 @@ namespace mRemoteNG.UI.Menu private void mMenFileLoad_Click(object sender, EventArgs e) { - if (Runtime.IsConnectionsFileLoaded) + if (Runtime.ConnectionsService.IsConnectionsFileLoaded) { var msgBoxResult = MessageBox.Show(Language.strSaveConnectionsFileBeforeOpeningAnother, Language.strSave, MessageBoxButtons.YesNoCancel); // ReSharper disable once SwitchStatementMissingSomeCases