From 36b32786981857e34308b191d2ca71e5aea6283e Mon Sep 17 00:00:00 2001 From: David Sparer Date: Wed, 10 May 2017 17:59:58 -0600 Subject: [PATCH] moved a property from Runtime to ConnectionsService --- mRemoteV1/App/Runtime.cs | 3 +-- mRemoteV1/Config/Connections/ConnectionsSaver.cs | 2 +- .../ConnectionSerializers/XmlConnectionsDeserializer.cs | 6 +++--- mRemoteV1/Config/Serializers/DataTableDeserializer.cs | 2 +- mRemoteV1/Connection/ConnectionsService.cs | 2 ++ mRemoteV1/UI/Forms/frmMain.cs | 2 +- mRemoteV1/UI/Menu/MainFileMenu.cs | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/mRemoteV1/App/Runtime.cs b/mRemoteV1/App/Runtime.cs index 83bac9a2..cb8bda5a 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 b2bfda22..2a706a0f 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 7d1ef306..a229ec0d 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 a71bfb95..c7c220b0 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 de666129..6540d14d 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 025bcc9b..3656455e 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 6807fcac..043d9388 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