moved a property from Runtime to ConnectionsService

This commit is contained in:
David Sparer
2017-05-10 17:59:58 -06:00
parent 2633b4c876
commit 36b3278698
7 changed files with 10 additions and 9 deletions

View File

@@ -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
{

View File

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

View File

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

View File

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

View File

@@ -11,6 +11,8 @@ namespace mRemoteNG.Connection
{
public class ConnectionsService
{
public bool IsConnectionsFileLoaded { get; set; }
public void NewConnections(string filename)
{
try

View File

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

View File

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