mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-25 19:38:37 +08:00
Merge pull request #458 from mRemoteNG/frmmain_menus_refactor_option2
Frmmain menus refactor option2
This commit is contained in:
@@ -8,6 +8,7 @@ using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Themes;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.UI.Forms;
|
||||
|
||||
namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
@@ -20,15 +21,10 @@ namespace mRemoteNG.UI.Controls
|
||||
private ContextMenuStrip _mnuQuickConnectProtocol;
|
||||
private QuickConnectComboBox _cmbQuickConnect;
|
||||
private ContextMenuStrip _mnuConnections;
|
||||
private readonly IConnectionInitiator _connectionInitiator;
|
||||
|
||||
|
||||
public QuickConnectToolStrip(IConnectionInitiator connectionInitiator)
|
||||
public QuickConnectToolStrip()
|
||||
{
|
||||
if (connectionInitiator == null)
|
||||
throw new ArgumentNullException(nameof(connectionInitiator));
|
||||
|
||||
_connectionInitiator = connectionInitiator;
|
||||
Initialize();
|
||||
ApplyThemes();
|
||||
PopulateQuickConnectProtocolMenu();
|
||||
@@ -169,7 +165,7 @@ namespace mRemoteNG.UI.Controls
|
||||
return;
|
||||
}
|
||||
_cmbQuickConnect.Add(connectionInfo);
|
||||
_connectionInitiator.OpenConnection(connectionInfo, ConnectionInfo.Force.DoNotJump);
|
||||
FrmMain.Default._connectionInitiator.OpenConnection(connectionInfo, ConnectionInfo.Force.DoNotJump);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -219,7 +215,7 @@ namespace mRemoteNG.UI.Controls
|
||||
var tag = ((ToolStripMenuItem)sender).Tag as ConnectionInfo;
|
||||
if (tag != null)
|
||||
{
|
||||
_connectionInitiator.OpenConnection(tag);
|
||||
FrmMain.Default._connectionInitiator.OpenConnection(tag);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
115
mRemoteV1/UI/Forms/frmMain.Designer.cs
generated
115
mRemoteV1/UI/Forms/frmMain.Designer.cs
generated
@@ -1,3 +1,5 @@
|
||||
using mRemoteNG.UI.Controls;
|
||||
|
||||
namespace mRemoteNG.UI.Forms
|
||||
{
|
||||
public partial class FrmMain : System.Windows.Forms.Form
|
||||
@@ -36,6 +38,12 @@ namespace mRemoteNG.UI.Forms
|
||||
this.mMenSep3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.tsContainer = new System.Windows.Forms.ToolStripContainer();
|
||||
this.tmrAutoSave = new System.Windows.Forms.Timer(this.components);
|
||||
this._externalToolsToolStrip = new mRemoteNG.UI.Controls.ExternalToolsToolStrip();
|
||||
this._quickConnectToolStrip = new mRemoteNG.UI.Controls.QuickConnectToolStrip();
|
||||
this.mainFileMenu1 = new mRemoteNG.UI.Menu.MainFileMenu();
|
||||
this.viewMenu1 = new mRemoteNG.UI.Menu.ViewMenu();
|
||||
this.toolsMenu1 = new mRemoteNG.UI.Menu.ToolsMenu();
|
||||
this.helpMenu1 = new mRemoteNG.UI.Menu.HelpMenu();
|
||||
this.msMain.SuspendLayout();
|
||||
this.tsContainer.ContentPanel.SuspendLayout();
|
||||
this.tsContainer.TopToolStripPanel.SuspendLayout();
|
||||
@@ -50,23 +58,48 @@ namespace mRemoteNG.UI.Forms
|
||||
this.pnlDock.DockRightPortion = 230D;
|
||||
this.pnlDock.DocumentStyle = WeifenLuo.WinFormsUI.Docking.DocumentStyle.DockingSdi;
|
||||
this.pnlDock.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnlDock.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.pnlDock.Name = "pnlDock";
|
||||
this.pnlDock.Size = new System.Drawing.Size(966, 449);
|
||||
this.pnlDock.Size = new System.Drawing.Size(1288, 594);
|
||||
this.pnlDock.TabIndex = 13;
|
||||
this.pnlDock.ActiveDocumentChanged += new System.EventHandler(this.pnlDock_ActiveDocumentChanged);
|
||||
//
|
||||
// msMain
|
||||
//
|
||||
this.msMain.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.msMain.GripMargin = new System.Windows.Forms.Padding(0);
|
||||
this.msMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mainFileMenu1,
|
||||
this.viewMenu1,
|
||||
this.toolsMenu1,
|
||||
this.helpMenu1});
|
||||
this.msMain.Location = new System.Drawing.Point(3, 0);
|
||||
this.msMain.Name = "msMain";
|
||||
this.msMain.Padding = new System.Windows.Forms.Padding(2, 2, 0, 2);
|
||||
this.msMain.Size = new System.Drawing.Size(269, 24);
|
||||
this.msMain.Size = new System.Drawing.Size(268, 24);
|
||||
this.msMain.Stretch = false;
|
||||
this.msMain.TabIndex = 16;
|
||||
this.msMain.Text = "Main Toolbar";
|
||||
//
|
||||
// mMenFile
|
||||
//
|
||||
this.mMenFile.Name = "mMenFile";
|
||||
this.mMenFile.Size = new System.Drawing.Size(32, 19);
|
||||
//
|
||||
// mMenView
|
||||
//
|
||||
this.mMenView.Name = "mMenView";
|
||||
this.mMenView.Size = new System.Drawing.Size(32, 19);
|
||||
//
|
||||
// mMenTools
|
||||
//
|
||||
this.mMenTools.Name = "mMenTools";
|
||||
this.mMenTools.Size = new System.Drawing.Size(32, 19);
|
||||
//
|
||||
// mMenInfo
|
||||
//
|
||||
this.mMenInfo.Name = "mMenInfo";
|
||||
this.mMenInfo.Size = new System.Drawing.Size(32, 19);
|
||||
//
|
||||
// mMenSep3
|
||||
//
|
||||
this.mMenSep3.Name = "mMenSep3";
|
||||
@@ -78,16 +111,20 @@ namespace mRemoteNG.UI.Forms
|
||||
// tsContainer.ContentPanel
|
||||
//
|
||||
this.tsContainer.ContentPanel.Controls.Add(this.pnlDock);
|
||||
this.tsContainer.ContentPanel.Size = new System.Drawing.Size(966, 449);
|
||||
this.tsContainer.ContentPanel.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tsContainer.ContentPanel.Size = new System.Drawing.Size(1288, 594);
|
||||
this.tsContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tsContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.tsContainer.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tsContainer.Name = "tsContainer";
|
||||
this.tsContainer.Size = new System.Drawing.Size(966, 523);
|
||||
this.tsContainer.Size = new System.Drawing.Size(1288, 644);
|
||||
this.tsContainer.TabIndex = 17;
|
||||
this.tsContainer.Text = "ToolStripContainer1";
|
||||
//
|
||||
// tsContainer.TopToolStripPanel
|
||||
//
|
||||
this.tsContainer.TopToolStripPanel.Controls.Add(this._externalToolsToolStrip);
|
||||
this.tsContainer.TopToolStripPanel.Controls.Add(this._quickConnectToolStrip);
|
||||
this.tsContainer.TopToolStripPanel.Controls.Add(this.msMain);
|
||||
//
|
||||
// tmrAutoSave
|
||||
@@ -95,14 +132,70 @@ namespace mRemoteNG.UI.Forms
|
||||
this.tmrAutoSave.Interval = 10000;
|
||||
this.tmrAutoSave.Tick += new System.EventHandler(this.tmrAutoSave_Tick);
|
||||
//
|
||||
// frmMain
|
||||
// _externalToolsToolStrip
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this._externalToolsToolStrip.BackColor = System.Drawing.SystemColors.Control;
|
||||
this._externalToolsToolStrip.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this._externalToolsToolStrip.Location = new System.Drawing.Point(271, 0);
|
||||
this._externalToolsToolStrip.MaximumSize = new System.Drawing.Size(0, 25);
|
||||
this._externalToolsToolStrip.Name = "_externalToolsToolStrip";
|
||||
this._externalToolsToolStrip.Size = new System.Drawing.Size(111, 25);
|
||||
this._externalToolsToolStrip.TabIndex = 17;
|
||||
//
|
||||
// _quickConnectToolStrip
|
||||
//
|
||||
this._quickConnectToolStrip.BackColor = System.Drawing.SystemColors.Control;
|
||||
this._quickConnectToolStrip.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this._quickConnectToolStrip.Location = new System.Drawing.Point(3, 25);
|
||||
this._quickConnectToolStrip.MaximumSize = new System.Drawing.Size(0, 25);
|
||||
this._quickConnectToolStrip.Name = "_quickConnectToolStrip";
|
||||
this._quickConnectToolStrip.Size = new System.Drawing.Size(364, 25);
|
||||
this._quickConnectToolStrip.TabIndex = 18;
|
||||
//
|
||||
// mainFileMenu1
|
||||
//
|
||||
this.mainFileMenu1.ConnectionInitiator = null;
|
||||
this.mainFileMenu1.Name = "mMenFile";
|
||||
this.mainFileMenu1.Size = new System.Drawing.Size(37, 20);
|
||||
this.mainFileMenu1.Text = "&File";
|
||||
this.mainFileMenu1.TreeWindow = null;
|
||||
this.mainFileMenu1.DropDownOpening += new System.EventHandler(this.mainFileMenu1_DropDownOpening);
|
||||
//
|
||||
// viewMenu1
|
||||
//
|
||||
this.viewMenu1.FullscreenHandler = null;
|
||||
this.viewMenu1.MainForm = null;
|
||||
this.viewMenu1.Name = "mMenView";
|
||||
this.viewMenu1.Size = new System.Drawing.Size(44, 20);
|
||||
this.viewMenu1.Text = "&View";
|
||||
this.viewMenu1.TsExternalTools = null;
|
||||
this.viewMenu1.TsQuickConnect = null;
|
||||
this.viewMenu1.DropDownOpening += new System.EventHandler(this.ViewMenu_Opening);
|
||||
//
|
||||
// toolsMenu1
|
||||
//
|
||||
this.toolsMenu1.CredentialManager = null;
|
||||
this.toolsMenu1.MainForm = null;
|
||||
this.toolsMenu1.Name = "mMenTools";
|
||||
this.toolsMenu1.Size = new System.Drawing.Size(47, 20);
|
||||
this.toolsMenu1.Text = "&Tools";
|
||||
//
|
||||
// helpMenu1
|
||||
//
|
||||
this.helpMenu1.Name = "mMenInfo";
|
||||
this.helpMenu1.Size = new System.Drawing.Size(44, 20);
|
||||
this.helpMenu1.Text = "&Help";
|
||||
this.helpMenu1.TextDirection = System.Windows.Forms.ToolStripTextDirection.Horizontal;
|
||||
//
|
||||
// FrmMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(966, 523);
|
||||
this.ClientSize = new System.Drawing.Size(1288, 644);
|
||||
this.Controls.Add(this.tsContainer);
|
||||
this.Icon = global::mRemoteNG.Resources.mRemote_Icon;
|
||||
this.MainMenuStrip = this.msMain;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "FrmMain";
|
||||
this.Opacity = 0D;
|
||||
this.Text = "mRemoteNG";
|
||||
@@ -132,5 +225,11 @@ namespace mRemoteNG.UI.Forms
|
||||
internal System.Windows.Forms.Timer tmrAutoSave;
|
||||
internal System.Windows.Forms.ToolStripSeparator mMenSep3;
|
||||
private System.ComponentModel.IContainer components;
|
||||
private Menu.MainFileMenu mainFileMenu1;
|
||||
private Menu.ViewMenu viewMenu1;
|
||||
private Menu.ToolsMenu toolsMenu1;
|
||||
private Menu.HelpMenu helpMenu1;
|
||||
internal mRemoteNG.UI.Controls.QuickConnectToolStrip _quickConnectToolStrip;
|
||||
internal mRemoteNG.UI.Controls.ExternalToolsToolStrip _externalToolsToolStrip;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ using mRemoteNG.Credential;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Themes;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.UI.Controls;
|
||||
using mRemoteNG.UI.Menu;
|
||||
using mRemoteNG.UI.TaskDialog;
|
||||
using mRemoteNG.UI.Window;
|
||||
using Microsoft.Win32;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
namespace mRemoteNG.UI.Forms
|
||||
@@ -42,9 +42,8 @@ namespace mRemoteNG.UI.Forms
|
||||
private readonly ScreenSelectionSystemMenu _screenSystemMenu;
|
||||
private ConnectionInfo _selectedConnection;
|
||||
internal FullscreenHandler _fullscreen { get; set; }
|
||||
private readonly QuickConnectToolStrip _quickConnectToolStrip;
|
||||
private readonly ExternalToolsToolStrip _externalToolsToolStrip;
|
||||
private readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator();
|
||||
|
||||
internal readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator();
|
||||
private readonly string _credentialFilePath = Path.Combine(CredentialsFileInfo.CredentialsPath, CredentialsFileInfo.CredentialsFile);
|
||||
private readonly CredentialManager _credentialManager = Runtime.CredentialManager;
|
||||
|
||||
@@ -57,8 +56,7 @@ namespace mRemoteNG.UI.Forms
|
||||
_fullscreen = new FullscreenHandler(this);
|
||||
pnlDock.Theme = new VS2012LightTheme();
|
||||
_screenSystemMenu = new ScreenSelectionSystemMenu(this);
|
||||
_quickConnectToolStrip = new QuickConnectToolStrip(_connectionInitiator);
|
||||
_externalToolsToolStrip = new ExternalToolsToolStrip();
|
||||
|
||||
}
|
||||
|
||||
static FrmMain()
|
||||
@@ -136,13 +134,7 @@ namespace mRemoteNG.UI.Forms
|
||||
|
||||
Startup.Instance.InitializeProgram(messageCollector);
|
||||
|
||||
msMain.Items.AddRange(new ToolStripItem[]
|
||||
{
|
||||
new MainFileMenu(Windows.TreeForm, _connectionInitiator),
|
||||
new ViewMenu(_externalToolsToolStrip, _quickConnectToolStrip, _fullscreen, this),
|
||||
new ToolsMenu(this, _credentialManager),
|
||||
new HelpMenu()
|
||||
});
|
||||
SetMenuDependencies();
|
||||
|
||||
var settingsLoader = new SettingsLoader(this, messageCollector, _quickConnectToolStrip, _externalToolsToolStrip);
|
||||
settingsLoader.LoadSettings();
|
||||
@@ -173,6 +165,20 @@ namespace mRemoteNG.UI.Forms
|
||||
Opacity = 1;
|
||||
}
|
||||
|
||||
private void SetMenuDependencies()
|
||||
{
|
||||
mainFileMenu1.TreeWindow = Windows.TreeForm;
|
||||
mainFileMenu1.ConnectionInitiator = _connectionInitiator;
|
||||
|
||||
viewMenu1.TsExternalTools = _externalToolsToolStrip;
|
||||
viewMenu1.TsQuickConnect = _quickConnectToolStrip;
|
||||
viewMenu1.FullscreenHandler = _fullscreen;
|
||||
viewMenu1.MainForm = this;
|
||||
|
||||
toolsMenu1.MainForm = this;
|
||||
toolsMenu1.CredentialManager = _credentialManager;
|
||||
}
|
||||
|
||||
private void ApplyThemes()
|
||||
{
|
||||
pnlDock.DockBackColor = ThemeManager.ActiveTheme.WindowBackgroundColor;
|
||||
@@ -550,5 +556,15 @@ namespace mRemoteNG.UI.Forms
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void ViewMenu_Opening(object sender, EventArgs e)
|
||||
{
|
||||
viewMenu1.mMenView_DropDownOpening(sender, e);
|
||||
}
|
||||
|
||||
private void mainFileMenu1_DropDownOpening(object sender, EventArgs e)
|
||||
{
|
||||
mainFileMenu1.mMenFile_DropDownOpening(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,24 +118,15 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="msMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>375, 17</value>
|
||||
</metadata>
|
||||
<metadata name="_externalToolsToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>197, 17</value>
|
||||
</metadata>
|
||||
<metadata name="_quickConnectToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="tsQuickConnect.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>112, 17</value>
|
||||
</metadata>
|
||||
<metadata name="tsExternalTools.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>591, 17</value>
|
||||
</metadata>
|
||||
<metadata name="cMenExtAppsToolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>724, 17</value>
|
||||
</metadata>
|
||||
<metadata name="mnuQuickConnectProtocol.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>249, 17</value>
|
||||
</metadata>
|
||||
<metadata name="mnuConnections.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>447, 17</value>
|
||||
</metadata>
|
||||
<metadata name="tmrAutoSave.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>891, 17</value>
|
||||
<value>470, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -35,18 +35,11 @@ namespace mRemoteNG.UI.Menu
|
||||
private ToolStripMenuItem _mMenFileImport;
|
||||
private ToolStripMenuItem _mMenReconnectAll;
|
||||
|
||||
private readonly ConnectionTreeWindow _connectionTreeWindow;
|
||||
private readonly IConnectionInitiator _connectionInitiator;
|
||||
public ConnectionTreeWindow TreeWindow { get; set; }
|
||||
public IConnectionInitiator ConnectionInitiator { get; set; }
|
||||
|
||||
public MainFileMenu(ConnectionTreeWindow connectionTreeWindow, IConnectionInitiator connectionInitiator)
|
||||
public MainFileMenu()
|
||||
{
|
||||
if (connectionTreeWindow == null)
|
||||
throw new ArgumentNullException(nameof(connectionTreeWindow));
|
||||
if (connectionInitiator == null)
|
||||
throw new ArgumentNullException(nameof(connectionInitiator));
|
||||
|
||||
_connectionTreeWindow = connectionTreeWindow;
|
||||
_connectionInitiator = connectionInitiator;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
@@ -100,7 +93,7 @@ namespace mRemoteNG.UI.Menu
|
||||
Name = "mMenFile";
|
||||
Size = new System.Drawing.Size(37, 20);
|
||||
Text = Language.strMenuFile;
|
||||
DropDownOpening += mMenFile_DropDownOpening;
|
||||
//DropDownOpening += mMenFile_DropDownOpening;
|
||||
//
|
||||
// mMenFileNewConnection
|
||||
//
|
||||
@@ -263,9 +256,9 @@ namespace mRemoteNG.UI.Menu
|
||||
}
|
||||
|
||||
#region File
|
||||
private void mMenFile_DropDownOpening(object sender, EventArgs e)
|
||||
internal void mMenFile_DropDownOpening(object sender, EventArgs e)
|
||||
{
|
||||
var selectedNodeType = _connectionTreeWindow.SelectedNode?.GetTreeNodeType();
|
||||
var selectedNodeType = TreeWindow.SelectedNode?.GetTreeNodeType();
|
||||
// ReSharper disable once SwitchStatementMissingSomeCases
|
||||
switch (selectedNodeType)
|
||||
{
|
||||
@@ -335,13 +328,13 @@ namespace mRemoteNG.UI.Menu
|
||||
|
||||
private void mMenFileNewConnection_Click(object sender, EventArgs e)
|
||||
{
|
||||
_connectionTreeWindow.ConnectionTree.AddConnection();
|
||||
TreeWindow.ConnectionTree.AddConnection();
|
||||
Runtime.SaveConnectionsAsync();
|
||||
}
|
||||
|
||||
private void mMenFileNewFolder_Click(object sender, EventArgs e)
|
||||
{
|
||||
_connectionTreeWindow.ConnectionTree.AddFolder();
|
||||
TreeWindow.ConnectionTree.AddFolder();
|
||||
Runtime.SaveConnectionsAsync();
|
||||
}
|
||||
|
||||
@@ -387,19 +380,19 @@ namespace mRemoteNG.UI.Menu
|
||||
|
||||
private void mMenFileDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
_connectionTreeWindow.ConnectionTree.DeleteSelectedNode();
|
||||
TreeWindow.ConnectionTree.DeleteSelectedNode();
|
||||
Runtime.SaveConnectionsAsync();
|
||||
}
|
||||
|
||||
private void mMenFileRename_Click(object sender, EventArgs e)
|
||||
{
|
||||
_connectionTreeWindow.ConnectionTree.RenameSelectedNode();
|
||||
TreeWindow.ConnectionTree.RenameSelectedNode();
|
||||
Runtime.SaveConnectionsAsync();
|
||||
}
|
||||
|
||||
private void mMenFileDuplicate_Click(object sender, EventArgs e)
|
||||
{
|
||||
_connectionTreeWindow.ConnectionTree.DuplicateSelectedNode();
|
||||
TreeWindow.ConnectionTree.DuplicateSelectedNode();
|
||||
Runtime.SaveConnectionsAsync();
|
||||
}
|
||||
|
||||
@@ -425,7 +418,7 @@ namespace mRemoteNG.UI.Menu
|
||||
foreach (var i in icList)
|
||||
{
|
||||
i.Protocol.Close();
|
||||
_connectionInitiator.OpenConnection(i.Info, ConnectionInfo.Force.DoNotJump);
|
||||
ConnectionInitiator.OpenConnection(i.Info, ConnectionInfo.Force.DoNotJump);
|
||||
}
|
||||
|
||||
// throw it on the garbage collector
|
||||
@@ -436,7 +429,7 @@ namespace mRemoteNG.UI.Menu
|
||||
|
||||
private void mMenFileImportFromFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
var selectedNode = _connectionTreeWindow.SelectedNode;
|
||||
var selectedNode = TreeWindow.SelectedNode;
|
||||
ContainerInfo importDestination;
|
||||
if (selectedNode == null)
|
||||
importDestination = Runtime.ConnectionTreeModel.RootNodes.First();
|
||||
|
||||
@@ -16,13 +16,12 @@ namespace mRemoteNG.UI.Menu
|
||||
private ToolStripMenuItem _mMenToolsUvncsc;
|
||||
private ToolStripMenuItem _mMenToolsComponentsCheck;
|
||||
private ToolStripMenuItem _credentialManagerToolStripMenuItem;
|
||||
private readonly CredentialManager _credentialManager;
|
||||
private readonly Form _form;
|
||||
|
||||
public ToolsMenu(Form form, CredentialManager credentialManager)
|
||||
public CredentialManager CredentialManager { get; set; }
|
||||
public Form MainForm { get; set; }
|
||||
|
||||
public ToolsMenu()
|
||||
{
|
||||
_form = form;
|
||||
_credentialManager = credentialManager;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
@@ -119,11 +118,11 @@ namespace mRemoteNG.UI.Menu
|
||||
#region Tools
|
||||
private void credentialManagerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var credentialManagerForm = new CredentialManagerForm(_credentialManager)
|
||||
var credentialManagerForm = new CredentialManagerForm(CredentialManager)
|
||||
{
|
||||
DeletionConfirmer = new CredentialDeletionMsgBoxConfirmer(MessageBox.Show)
|
||||
};
|
||||
credentialManagerForm.CenterOnTarget(_form);
|
||||
credentialManagerForm.CenterOnTarget(MainForm);
|
||||
credentialManagerForm.Show();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,19 +25,15 @@ namespace mRemoteNG.UI.Menu
|
||||
private ToolStripMenuItem _mMenViewJumpToErrorsInfos;
|
||||
private ToolStripMenuItem _mMenViewResetLayout;
|
||||
private ToolStripSeparator _toolStripSeparator1;
|
||||
private readonly ToolStrip _tsExternalTools;
|
||||
private readonly ToolStrip _tsQuickConnect;
|
||||
private readonly FullscreenHandler _fullscreenHandler;
|
||||
private readonly FrmMain _mainForm;
|
||||
|
||||
public ToolStrip TsExternalTools { get; set; }
|
||||
public ToolStrip TsQuickConnect { get; set; }
|
||||
public FullscreenHandler FullscreenHandler { get; set; }
|
||||
public FrmMain MainForm { get; set; }
|
||||
|
||||
|
||||
public ViewMenu(ToolStrip tsExternalTools, ToolStrip tsQuickConnect, FullscreenHandler fullscreenHandler, FrmMain mainForm)
|
||||
public ViewMenu()
|
||||
{
|
||||
_tsExternalTools = tsExternalTools;
|
||||
_tsQuickConnect = tsQuickConnect;
|
||||
_fullscreenHandler = fullscreenHandler;
|
||||
_mainForm = mainForm;
|
||||
|
||||
Initialize();
|
||||
ApplyLanguage();
|
||||
}
|
||||
@@ -84,7 +80,7 @@ namespace mRemoteNG.UI.Menu
|
||||
Name = "mMenView";
|
||||
Size = new System.Drawing.Size(44, 20);
|
||||
Text = Language.strMenuView;
|
||||
DropDownOpening += mMenView_DropDownOpening;
|
||||
//DropDownOpening += mMenView_DropDownOpening;
|
||||
//
|
||||
// mMenViewAddConnectionPanel
|
||||
//
|
||||
@@ -242,15 +238,15 @@ namespace mRemoteNG.UI.Menu
|
||||
}
|
||||
|
||||
#region View
|
||||
private void mMenView_DropDownOpening(object sender, EventArgs e)
|
||||
internal void mMenView_DropDownOpening(object sender, EventArgs e)
|
||||
{
|
||||
_mMenViewConnections.Checked = !Windows.TreeForm.IsHidden;
|
||||
_mMenViewConfig.Checked = !Windows.ConfigForm.IsHidden;
|
||||
_mMenViewErrorsAndInfos.Checked = !Windows.ErrorsForm.IsHidden;
|
||||
_mMenViewScreenshotManager.Checked = !Windows.ScreenshotForm.IsHidden;
|
||||
|
||||
_mMenViewExtAppsToolbar.Checked = _tsExternalTools.Visible;
|
||||
_mMenViewQuickConnectToolbar.Checked = _tsQuickConnect.Visible;
|
||||
_mMenViewExtAppsToolbar.Checked = TsExternalTools.Visible;
|
||||
_mMenViewQuickConnectToolbar.Checked = TsQuickConnect.Visible;
|
||||
|
||||
_mMenViewConnectionPanels.DropDownItems.Clear();
|
||||
|
||||
@@ -267,7 +263,7 @@ namespace mRemoteNG.UI.Menu
|
||||
|
||||
private void ConnectionPanelMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
((BaseWindow)((ToolStripMenuItem)sender).Tag).Show(_mainForm.pnlDock);
|
||||
((BaseWindow)((ToolStripMenuItem)sender).Tag).Show(MainForm.pnlDock);
|
||||
((BaseWindow)((ToolStripMenuItem)sender).Tag).Focus();
|
||||
}
|
||||
|
||||
@@ -275,7 +271,7 @@ namespace mRemoteNG.UI.Menu
|
||||
{
|
||||
if (_mMenViewConnections.Checked == false)
|
||||
{
|
||||
Windows.TreeForm.Show(_mainForm.pnlDock);
|
||||
Windows.TreeForm.Show(MainForm.pnlDock);
|
||||
_mMenViewConnections.Checked = true;
|
||||
}
|
||||
else
|
||||
@@ -289,7 +285,7 @@ namespace mRemoteNG.UI.Menu
|
||||
{
|
||||
if (_mMenViewConfig.Checked == false)
|
||||
{
|
||||
Windows.ConfigForm.Show(_mainForm.pnlDock);
|
||||
Windows.ConfigForm.Show(MainForm.pnlDock);
|
||||
_mMenViewConfig.Checked = true;
|
||||
}
|
||||
else
|
||||
@@ -303,7 +299,7 @@ namespace mRemoteNG.UI.Menu
|
||||
{
|
||||
if (_mMenViewErrorsAndInfos.Checked == false)
|
||||
{
|
||||
Windows.ErrorsForm.Show(_mainForm.pnlDock);
|
||||
Windows.ErrorsForm.Show(MainForm.pnlDock);
|
||||
_mMenViewErrorsAndInfos.Checked = true;
|
||||
}
|
||||
else
|
||||
@@ -317,7 +313,7 @@ namespace mRemoteNG.UI.Menu
|
||||
{
|
||||
if (_mMenViewScreenshotManager.Checked == false)
|
||||
{
|
||||
Windows.ScreenshotForm.Show(_mainForm.pnlDock);
|
||||
Windows.ScreenshotForm.Show(MainForm.pnlDock);
|
||||
_mMenViewScreenshotManager.Checked = true;
|
||||
}
|
||||
else
|
||||
@@ -329,7 +325,7 @@ namespace mRemoteNG.UI.Menu
|
||||
|
||||
private void mMenViewJumpToConnectionsConfig_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_mainForm.pnlDock.ActiveContent == Windows.TreeForm)
|
||||
if (MainForm.pnlDock.ActiveContent == Windows.TreeForm)
|
||||
{
|
||||
Windows.ConfigForm.Activate();
|
||||
}
|
||||
@@ -350,7 +346,7 @@ namespace mRemoteNG.UI.Menu
|
||||
MessageBoxIcon.Question);
|
||||
if (msgBoxResult == DialogResult.Yes)
|
||||
{
|
||||
_mainForm.SetDefaultLayout();
|
||||
MainForm.SetDefaultLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,12 +359,12 @@ namespace mRemoteNG.UI.Menu
|
||||
{
|
||||
if (_mMenViewExtAppsToolbar.Checked == false)
|
||||
{
|
||||
_tsExternalTools.Visible = true;
|
||||
TsExternalTools.Visible = true;
|
||||
_mMenViewExtAppsToolbar.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tsExternalTools.Visible = false;
|
||||
TsExternalTools.Visible = false;
|
||||
_mMenViewExtAppsToolbar.Checked = false;
|
||||
}
|
||||
}
|
||||
@@ -377,20 +373,20 @@ namespace mRemoteNG.UI.Menu
|
||||
{
|
||||
if (_mMenViewQuickConnectToolbar.Checked == false)
|
||||
{
|
||||
_tsQuickConnect.Visible = true;
|
||||
TsQuickConnect.Visible = true;
|
||||
_mMenViewQuickConnectToolbar.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tsQuickConnect.Visible = false;
|
||||
TsQuickConnect.Visible = false;
|
||||
_mMenViewQuickConnectToolbar.Checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void mMenViewFullscreen_Click(object sender, EventArgs e)
|
||||
{
|
||||
_fullscreenHandler.Value = !_fullscreenHandler.Value;
|
||||
_mMenViewFullscreen.Checked = _fullscreenHandler.Value;
|
||||
FullscreenHandler.Value = !FullscreenHandler.Value;
|
||||
_mMenViewFullscreen.Checked = FullscreenHandler.Value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user