fixed an incomplete merge

This commit is contained in:
David Sparer
2018-10-25 10:26:28 -05:00
parent 7a54b98ea2
commit 7445e917d6
4 changed files with 23 additions and 20 deletions

View File

@@ -1,11 +1,10 @@
using System.IO;
using mRemoteNG.Config.Connections;
using mRemoteNG.Connection;
using mRemoteNG.Connection;
using mRemoteNG.Tools;
using System.IO;
namespace mRemoteNG.App.Initialization
{
public class CredsAndConsSetup
public class CredsAndConsSetup
{
private readonly IConnectionsService _connectionsService;
@@ -16,8 +15,6 @@ namespace mRemoteNG.App.Initialization
public void LoadCredsAndCons()
{
new SaveConnectionsOnEdit(_connectionsService);
if (Settings.Default.FirstStart && !Settings.Default.LoadConsFromCustomLocation && !File.Exists(_connectionsService.GetStartupConnectionFileName()))
_connectionsService.NewConnectionsFile(_connectionsService.GetStartupConnectionFileName());

View File

@@ -1,8 +1,7 @@
using System;
using mRemoteNG.Connection;
using System;
using System.Collections.Specialized;
using System.ComponentModel;
using mRemoteNG.Connection;
using mRemoteNG.UI.Forms;
namespace mRemoteNG.Config.Connections
{
@@ -10,6 +9,8 @@ namespace mRemoteNG.Config.Connections
{
private readonly IConnectionsService _connectionsService;
public bool Enabled { get; set; } = true;
public SaveConnectionsOnEdit(IConnectionsService connectionsService)
{
if (connectionsService == null)
@@ -45,7 +46,8 @@ namespace mRemoteNG.Config.Connections
{
if (!mRemoteNG.Settings.Default.SaveConnectionsAfterEveryEdit)
return;
if (FrmMain.Default.IsClosing)
if (!Enabled)
return;
_connectionsService.SaveConnectionsAsync();

View File

@@ -72,6 +72,7 @@ namespace mRemoteNG.UI.Forms
private readonly Screens _screens;
private readonly FileBackupPruner _backupPruner;
private readonly MessageCollector _messageCollector = Runtime.MessageCollector;
private SaveConnectionsOnEdit _saveConnectionsOnEdit;
internal FullscreenHandler Fullscreen { get; set; }
@@ -242,6 +243,8 @@ namespace mRemoteNG.UI.Forms
_connectionsService.ConnectionsLoaded += ConnectionsServiceOnConnectionsLoaded;
_connectionsService.ConnectionsSaved += ConnectionsServiceOnConnectionsSaved;
_saveConnectionsOnEdit = new SaveConnectionsOnEdit(_connectionsService);
var credsAndConsSetup = new CredsAndConsSetup(_connectionsService);
credsAndConsSetup.LoadCredsAndCons();
@@ -448,6 +451,7 @@ namespace mRemoteNG.UI.Forms
_shutdown.Cleanup(_quickConnectToolStrip, _externalToolsToolStrip, _multiSshToolStrip, this);
IsClosing = true;
_saveConnectionsOnEdit.Enabled = false;
if (_windowList != null)
{

View File

@@ -1,18 +1,17 @@
using System;
using mRemoteNG.App;
using mRemoteNG.Messages;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms.Input;
using mRemoteNG.UI.Window;
using System;
using System.Collections;
using System.Linq;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.Messages;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.Forms.Input;
using mRemoteNG.UI.Window;
using WeifenLuo.WinFormsUI.Docking;
namespace mRemoteNG.UI.Panels
{
public class PanelAdder
public class PanelAdder
{
private readonly WindowList _windowList;
private readonly Screens _screens;
@@ -47,8 +46,9 @@ namespace mRemoteNG.UI.Panels
public bool DoesPanelExist(string panelName)
{
return Runtime.WindowList?.OfType<ConnectionWindow>().Any(w => w.TabText == panelName)
?? false;
return _windowList
.OfType<ConnectionWindow>()
.Any(w => w.TabText == panelName);
}
private void ShowConnectionWindow(ConnectionWindow connectionForm)