mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
moved a property from Runtime to ConnectionsService
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace mRemoteNG.Connection
|
||||
{
|
||||
public class ConnectionsService
|
||||
{
|
||||
public bool IsConnectionsFileLoaded { get; set; }
|
||||
|
||||
public void NewConnections(string filename)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user