more cleanup of the Windows class

This commit is contained in:
David Sparer
2017-02-03 11:07:40 -07:00
parent dee9e3c326
commit f564efb4d6
9 changed files with 25 additions and 56 deletions

View File

@@ -3,27 +3,18 @@ using mRemoteNG.UI.Window;
using System;
using mRemoteNG.Messages;
using mRemoteNG.UI;
using WeifenLuo.WinFormsUI.Docking;
namespace mRemoteNG.App
{
public static class Windows
{
private static AboutWindow _aboutForm;
private static DockContent _aboutPanel = new DockContent();
private static DockContent _sshtransferPanel = new DockContent();
private static ActiveDirectoryImportWindow _adimportForm;
private static DockContent _adimportPanel = new DockContent();
private static HelpWindow _helpForm;
private static DockContent _helpPanel = new DockContent();
private static ExternalToolsWindow _externalappsForm;
private static DockContent _externalappsPanel = new DockContent();
private static PortScanWindow _portscanForm;
private static DockContent _portscanPanel = new DockContent();
private static UltraVNCWindow _ultravncscForm;
private static DockContent _ultravncscPanel = new DockContent();
private static ComponentsCheckWindow _componentscheckForm;
private static DockContent _componentscheckPanel = new DockContent();
public static ConnectionTreeWindow TreeForm { get; set; } = new ConnectionTreeWindow();
public static ConfigWindow ConfigForm { get; set; } = new ConfigWindow();
@@ -40,20 +31,14 @@ namespace mRemoteNG.App
if (windowType.Equals(WindowType.About))
{
if (_aboutForm == null || _aboutForm.IsDisposed)
{
_aboutForm = new AboutWindow(_aboutPanel);
_aboutPanel = _aboutForm;
}
_aboutForm = new AboutWindow();
_aboutForm.Show(frmMain.Default.pnlDock);
}
else if (windowType.Equals(WindowType.ActiveDirectoryImport))
{
if (_adimportForm == null || _adimportForm.IsDisposed)
{
_adimportForm = new ActiveDirectoryImportWindow(_adimportPanel);
_adimportPanel = _adimportForm;
}
_adimportPanel.Show(frmMain.Default.pnlDock);
_adimportForm = new ActiveDirectoryImportWindow();
_adimportForm.Show(frmMain.Default.pnlDock);
}
else if (windowType.Equals(WindowType.Options))
{
@@ -64,59 +49,43 @@ namespace mRemoteNG.App
}
else if (windowType.Equals(WindowType.SSHTransfer))
{
SshtransferForm = new SSHTransferWindow(_sshtransferPanel);
_sshtransferPanel = SshtransferForm;
SshtransferForm = new SSHTransferWindow();
SshtransferForm.Show(frmMain.Default.pnlDock);
}
else if (windowType.Equals(WindowType.Update))
{
if (UpdateForm == null || UpdateForm.IsDisposed)
{
UpdateForm = new UpdateWindow();
}
UpdateForm.Show(frmMain.Default.pnlDock);
}
else if (windowType.Equals(WindowType.Help))
{
if (_helpForm == null || _helpForm.IsDisposed)
{
_helpForm = new HelpWindow(_helpPanel);
_helpPanel = _helpForm;
}
_helpForm = new HelpWindow();
_helpForm.Show(frmMain.Default.pnlDock);
}
else if (windowType.Equals(WindowType.ExternalApps))
{
if (_externalappsForm == null || _externalappsForm.IsDisposed)
{
_externalappsForm = new ExternalToolsWindow(_externalappsPanel);
_externalappsPanel = _externalappsForm;
}
_externalappsForm = new ExternalToolsWindow();
_externalappsForm.Show(frmMain.Default.pnlDock);
}
else if (windowType.Equals(WindowType.PortScan))
{
_portscanForm = new PortScanWindow(_portscanPanel);
_portscanPanel = _portscanForm;
_portscanForm = new PortScanWindow();
_portscanForm.Show(frmMain.Default.pnlDock);
}
else if (windowType.Equals(WindowType.UltraVNCSC))
{
if (_ultravncscForm == null || _ultravncscForm.IsDisposed)
{
_ultravncscForm = new UltraVNCWindow(_ultravncscPanel);
_ultravncscPanel = _ultravncscForm;
}
_ultravncscForm = new UltraVNCWindow();
_ultravncscForm.Show(frmMain.Default.pnlDock);
}
else if (windowType.Equals(WindowType.ComponentsCheck))
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, "Showing ComponentsCheck window", true);
if (_componentscheckForm == null || _componentscheckForm.IsDisposed)
{
_componentscheckForm = new ComponentsCheckWindow(_componentscheckPanel);
_componentscheckPanel = _componentscheckForm;
}
_componentscheckForm = new ComponentsCheckWindow();
_componentscheckForm.Show(frmMain.Default.pnlDock);
}
}

View File

@@ -248,10 +248,10 @@ namespace mRemoteNG.UI.Window
#endregion
#region Public Methods
public AboutWindow(DockContent Panel)
public AboutWindow()
{
WindowType = WindowType.About;
DockPnl = Panel;
DockPnl = new DockContent();
InitializeComponent();
Runtime.FontOverride(this);
}

View File

@@ -14,12 +14,12 @@ namespace mRemoteNG.UI.Window
#region Constructors
public ActiveDirectoryImportWindow(DockContent panel)
public ActiveDirectoryImportWindow()
{
InitializeComponent();
Runtime.FontOverride(this);
WindowType = WindowType.ActiveDirectoryImport;
DockPnl = panel;
DockPnl = new DockContent();
CurrentDomain = Environment.UserDomainName;
}

View File

@@ -394,10 +394,10 @@ namespace mRemoteNG.UI.Window
#endregion
#region Public Methods
public ComponentsCheckWindow(DockContent Panel)
public ComponentsCheckWindow()
{
WindowType = WindowType.ComponentsCheck;
DockPnl = Panel;
DockPnl = new DockContent();
InitializeComponent();
}
#endregion

View File

@@ -11,12 +11,12 @@ namespace mRemoteNG.UI.Window
public partial class ExternalToolsWindow
{
#region Constructors
public ExternalToolsWindow(DockContent panel)
public ExternalToolsWindow()
{
InitializeComponent();
WindowType = WindowType.ExternalApps;
DockPnl = panel;
DockPnl = new DockContent();
}
#endregion

View File

@@ -213,10 +213,10 @@ namespace mRemoteNG.UI.Window
#endregion
#region Public Methods
public HelpWindow(DockContent Panel)
public HelpWindow()
{
WindowType = WindowType.Help;
DockPnl = Panel;
DockPnl = new DockContent();
InitializeComponent();
FillImageList();

View File

@@ -15,12 +15,12 @@ namespace mRemoteNG.UI.Window
public partial class PortScanWindow
{
#region Constructors
public PortScanWindow(DockContent panel)
public PortScanWindow()
{
InitializeComponent();
WindowType = WindowType.PortScan;
DockPnl = panel;
DockPnl = new DockContent();
}
#endregion

View File

@@ -548,10 +548,10 @@ namespace mRemoteNG.UI.Window
#endregion
#region Public Methods
public SSHTransferWindow(DockContent Panel)
public SSHTransferWindow()
{
WindowType = WindowType.SSHTransfer;
DockPnl = Panel;
DockPnl = new DockContent();
InitializeComponent();
oDlg = new OpenFileDialog

View File

@@ -74,10 +74,10 @@ namespace mRemoteNG.UI.Window
#endregion
#region Public Methods
public UltraVNCWindow(DockContent Panel)
public UltraVNCWindow()
{
this.WindowType = WindowType.UltraVNCSC;
this.DockPnl = Panel;
this.DockPnl = new DockContent();
this.InitializeComponent();
}
#endregion