some more cleanup

This commit is contained in:
David Sparer
2017-05-07 18:32:18 -06:00
parent f334f804b6
commit 97104d820e
2 changed files with 11 additions and 7 deletions

View File

@@ -14,6 +14,8 @@ namespace mRemoteNG.Connection
{
public class ConnectionInitiator : IConnectionInitiator
{
private FrmMain _frmMain = FrmMain.Default;
public void OpenConnection(ContainerInfo containerInfo, ConnectionInfo.Force force = ConnectionInfo.Force.None)
{
OpenConnection(containerInfo, force, null);
@@ -50,7 +52,7 @@ namespace mRemoteNG.Connection
var connectionWindow = (ConnectionWindow)interfaceControl.FindForm();
connectionWindow?.Focus();
var findForm = (ConnectionWindow)interfaceControl.FindForm();
findForm?.Show(FrmMain.Default.pnlDock);
findForm?.Show(_frmMain.pnlDock);
var tabPage = (TabPage)interfaceControl.Parent;
tabPage.Selected = true;
return true;
@@ -114,7 +116,7 @@ namespace mRemoteNG.Connection
}
connectionInfo.OpenConnections.Add(newProtocol);
FrmMain.Default.SelectedConnection = connectionInfo;
_frmMain.SelectedConnection = connectionInfo;
}
catch (Exception ex)
{
@@ -168,14 +170,14 @@ namespace mRemoteNG.Connection
return connectionPanel;
}
private static Form SetConnectionForm(Form conForm, string connectionPanel)
private Form SetConnectionForm(Form conForm, string connectionPanel)
{
var connectionForm = conForm ?? Runtime.WindowList.FromString(connectionPanel);
if (connectionForm == null)
connectionForm = Runtime.AddPanel(connectionPanel);
else
((ConnectionWindow)connectionForm).Show(FrmMain.Default.pnlDock);
((ConnectionWindow)connectionForm).Show(_frmMain.pnlDock);
connectionForm.Focus();
return connectionForm;

View File

@@ -5,6 +5,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
public partial class ConnectionsPage
{
private FrmMain _frmMain = FrmMain.Default;
public ConnectionsPage()
{
InitializeComponent();
@@ -82,12 +84,12 @@ namespace mRemoteNG.UI.Forms.OptionsPages
Settings.Default.AutoSaveEveryMinutes = (int) numAutoSave.Value;
if (Settings.Default.AutoSaveEveryMinutes > 0)
{
FrmMain.Default.tmrAutoSave.Interval = Settings.Default.AutoSaveEveryMinutes*60000;
FrmMain.Default.tmrAutoSave.Enabled = true;
_frmMain.tmrAutoSave.Interval = Settings.Default.AutoSaveEveryMinutes*60000;
_frmMain.tmrAutoSave.Enabled = true;
}
else
{
FrmMain.Default.tmrAutoSave.Enabled = false;
_frmMain.tmrAutoSave.Enabled = false;
}
if (radCloseWarnAll.Checked)