Compare commits

..

25 Commits

Author SHA1 Message Date
David Sparer
f63980f122 Merge branch 'hotfix11' 2017-11-07 20:22:00 -06:00
David Sparer
9cee827f6b updated changelog 2017-11-07 20:21:13 -06:00
David Sparer
9c57976906 singleton instance should be given focus 2017-11-07 20:20:24 -06:00
David Sparer
ef5b09b6fa fix issue where /resetpanels did nothing 2017-11-07 16:35:25 -06:00
David Sparer
469b4224dc fixed bug with resetting window position
resetting window position now places app in center of main monitor like it should
2017-11-07 10:05:18 -06:00
David Sparer
afc410cfe6 fixed #778
custom cons param bug introduced in commit f73c9c9d
2017-11-07 08:21:32 -06:00
David Sparer
aed509155b inheritance button should be disabled when parent is root connection node 2017-11-05 09:04:10 -06:00
David Sparer
0120762dbe putty sessions should not have the inheritance button 2017-11-05 08:41:13 -06:00
David Sparer
85b67ecd0b fixed bug in connection tree context menu
right clicking in white space (no connection tree item selected) made the context menu appear with all options enabled. No context menu should appear in that case
2017-11-05 07:24:28 -06:00
David Sparer
7451383c24 putty nodes and root putty node should not have context menu items "import" or "export" 2017-11-05 07:09:17 -06:00
David Sparer
88d735ed56 resolved bug that would sometimes disable connection tree hot keys
bug was introduced in #652. I made sure that the original issue is still resolved
2017-11-04 22:04:08 -05:00
David Sparer
7a002e4b89 updated changelog 2017-11-04 11:45:14 -05:00
David Sparer
01ad0b4875 safer connection tree gui updating 2017-11-03 15:10:35 -05:00
David Sparer
4defa5fa9c Resolves #758
introduced in commit 8a3e3704
2017-11-03 15:09:18 -05:00
David Sparer
5ce8171f12 updated changelog 2017-11-01 15:29:54 -05:00
David Sparer
e3121cb043 bumped assembly version 2017-11-01 15:14:55 -05:00
David Sparer
99e52ab0b5 updated changelog 2017-10-31 15:08:06 -05:00
David Sparer
2b672dc4fc Fixed another minor issue with external tools 2017-10-31 14:07:18 -05:00
David Sparer
6db7adf900 re-implemented autoresizecolumn in the connection tree
I did this in order to get around a weird bug where the connection tree would sometimes be set to a very small width (making it not visible)
2017-10-31 13:10:49 -05:00
David Sparer
65782285a3 added a few unit tests for integrated programs 2017-10-31 09:56:48 -05:00
David Sparer
64bd5a93ad resolves #761 2017-10-31 08:11:57 -05:00
David Sparer
68f052efcb Merge branch 'hotfix10' 2017-10-29 12:44:53 -05:00
David Sparer
4a8baf79fb bumped assembly version 2017-10-29 12:44:18 -05:00
David Sparer
499ac0295e fixed one case where visible connection tree width wasnt being updated correctly 2017-10-29 12:33:29 -05:00
David Sparer
29c422501a resolves #756 2017-10-29 12:17:18 -05:00
18 changed files with 229 additions and 98 deletions

View File

@@ -1,3 +1,22 @@
1.75.7011 (2017-11-07):
Fixes:
------
#778: Custom connection file path command line argument (/c) not working
#763: Sometimes minimizing folder causes connection tree to disappear
#761: Connections using external tools do not start (introduced in v1.75.7009)
#758: "Decryption failed" message when loading from SQL server
Fixed issues with /resetpanels and /resetpos command line arguments
Resolved bug where connection tree hotkeys would sometimes be disabled
1.75.7010 (2017-10-29):
Fixes:
------
#756: CustomConsPath always null
1.75.7009 (2017-10-28):
Fixes:

View File

@@ -0,0 +1,57 @@
using System.Collections;
using mRemoteNG.App;
using mRemoteNG.Connection;
using mRemoteNG.Connection.Protocol;
using mRemoteNG.Tools;
using mRemoteNG.UI.Window;
using NUnit.Framework;
using WeifenLuo.WinFormsUI.Docking;
namespace mRemoteNGTests.Connection.Protocol
{
public class IntegratedProgramTests
{
private readonly ExternalTool _extTool = new ExternalTool
{
DisplayName = "notepad",
FileName = @"%windir%\system32\notepad.exe",
Arguments = "",
TryIntegrate = true
};
[Test]
public void CanStartExternalApp()
{
SetExternalToolList(_extTool);
var sut = new IntegratedProgram();
sut.InterfaceControl = BuildInterfaceControl("notepad", sut);
sut.Initialize();
var appStarted = sut.Connect();
sut.Disconnect();
Assert.That(appStarted);
}
[Test]
public void ConnectingToExternalAppThatDoesntExistDoesNothing()
{
SetExternalToolList(_extTool);
var sut = new IntegratedProgram();
sut.InterfaceControl = BuildInterfaceControl("doesntExist", sut);
var appInitialized = sut.Initialize();
Assert.That(appInitialized, Is.False);
}
private void SetExternalToolList(ExternalTool externalTool)
{
Runtime.ExternalTools = new ArrayList {externalTool};
}
private InterfaceControl BuildInterfaceControl(string extAppName, ProtocolBase sut)
{
var connectionWindow = new ConnectionWindow(new DockContent());
var connectionInfo = new ConnectionInfo {ExtApp = extAppName};
return new InterfaceControl(connectionWindow, sut, connectionInfo);
}
}
}

View File

@@ -123,6 +123,7 @@
<Compile Include="Config\Serializers\XmlRootNodeSerializerTests.cs" />
<Compile Include="Connection\AbstractConnectionInfoDataTests.cs" />
<Compile Include="Connection\ConnectionInfoComparerTests.cs" />
<Compile Include="Connection\Protocol\IntegratedProgramTests.cs" />
<Compile Include="Connection\Protocol\ProtocolListTests.cs" />
<Compile Include="IntegrationTests\XmlSerializationLifeCycleTests.cs" />
<Compile Include="Security\Authentication\PasswordAuthenticatorTests.cs" />

View File

@@ -56,6 +56,7 @@ namespace mRemoteNG.App
if (singletonInstanceWindowHandle == IntPtr.Zero) return;
if (NativeMethods.IsIconic(singletonInstanceWindowHandle) != 0)
NativeMethods.ShowWindow(singletonInstanceWindowHandle, (int)NativeMethods.SW_RESTORE);
NativeMethods.SetForegroundWindow(singletonInstanceWindowHandle);
}
private static IntPtr GetRunningSingletonInstanceWindowHandle()

View File

@@ -469,7 +469,7 @@ namespace mRemoteNG.App
connectionsSaver.SQLDatabaseName = Settings.Default.SQLDatabaseName;
connectionsSaver.SQLUsername = Settings.Default.SQLUser;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
connectionsSaver.SQLPassword = cryptographyProvider.Decrypt(Settings.Default.SQLUser, EncryptionKey);
connectionsSaver.SQLPassword = cryptographyProvider.Decrypt(Settings.Default.SQLPass, EncryptionKey);
}
connectionsSaver.SaveConnections();

View File

@@ -253,11 +253,11 @@ namespace mRemoteNG.App
var ConsParam = "";
if (cmd["cons"] != null)
{
ConsParam = "cons";
ConsParam = cmd["cons"];
}
if (cmd["c"] != null)
{
ConsParam = "c";
ConsParam = cmd["c"];
}
var ResetPosParam = "";
@@ -308,15 +308,22 @@ namespace mRemoteNG.App
}
// Handle custom connection file location
Settings.Default.CustomConsPath = GetCustomConsPath(ConsParam);
if (Settings.Default.CustomConsPath != null)
var consPathFromParam = GetCustomConsPath(ConsParam);
if (consPathFromParam != null)
{
Settings.Default.CustomConsPath = consPathFromParam;
Settings.Default.LoadConsFromCustomLocation = true;
}
if (!string.IsNullOrEmpty(ResetPosParam))
{
Settings.Default.MainFormKiosk = false;
Settings.Default.MainFormLocation = new Point(999, 999);
Settings.Default.MainFormSize = new Size(900, 600);
var newWidth = 900;
var newHeight = 600;
var newX = Screen.PrimaryScreen.WorkingArea.Width/2 - newWidth/2;
var newY = Screen.PrimaryScreen.WorkingArea.Height/2 - newHeight/2;
Settings.Default.MainFormLocation = new Point(newX, newY);
Settings.Default.MainFormSize = new Size(newWidth, newHeight);
Settings.Default.MainFormState = FormWindowState.Normal;
}

View File

@@ -1,11 +1,11 @@
using mRemoteNG.App;
using mRemoteNG.Tools;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.Messages;
using mRemoteNG.Tools;
namespace mRemoteNG.Connection.Protocol
@@ -21,9 +21,15 @@ namespace mRemoteNG.Connection.Protocol
#region Public Methods
public override bool Initialize()
{
if (InterfaceControl.Info == null) return base.Initialize();
if (InterfaceControl.Info == null)
return base.Initialize();
_externalTool = Runtime.GetExtAppByName(InterfaceControl.Info.Name);
_externalTool = Runtime.GetExtAppByName(InterfaceControl.Info.ExtApp);
if (_externalTool == null)
{
Runtime.MessageCollector?.AddMessage(MessageClass.ErrorMsg, string.Format(Language.CouldNotFindExternalTool, InterfaceControl.Info.ExtApp));
return false;
}
_externalTool.ConnectionInfo = InterfaceControl.Info;
return base.Initialize();
@@ -33,7 +39,7 @@ namespace mRemoteNG.Connection.Protocol
{
try
{
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, $"Attempting to start: {_externalTool.DisplayName}", true);
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, $"Attempting to start: {_externalTool.DisplayName}", true);
if (_externalTool.TryIntegrate == false)
{
@@ -43,7 +49,7 @@ namespace mRemoteNG.Connection.Protocol
* will be called - which is just going to call IntegratedProgram.Close() again anyway...
* Close();
*/
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, $"Assuming no other errors/exceptions occurred immediately before this message regarding {_externalTool.DisplayName}, the next \"closed by user\" message can be ignored", true);
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, $"Assuming no other errors/exceptions occurred immediately before this message regarding {_externalTool.DisplayName}, the next \"closed by user\" message can be ignored", true);
return false;
}
@@ -80,10 +86,10 @@ namespace mRemoteNG.Connection.Protocol
}
NativeMethods.SetParent(_handle, InterfaceControl.Handle);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strIntAppStuff, true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppHandle, _handle), true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppTitle, _process.MainWindowTitle), true);
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppParentHandle, InterfaceControl.Parent.Handle), true);
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, Language.strIntAppStuff, true);
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppHandle, _handle), true);
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppTitle, _process.MainWindowTitle), true);
Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppParentHandle, InterfaceControl.Parent.Handle), true);
Resize(this, new EventArgs());
base.Connect();
@@ -91,7 +97,7 @@ namespace mRemoteNG.Connection.Protocol
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppConnectionFailed, ex);
Runtime.MessageCollector?.AddExceptionMessage(Language.strIntAppConnectionFailed, ex);
return false;
}
}

View File

@@ -1,6 +1,6 @@
using System;
using System.Windows.Forms;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.Tools;
@@ -153,7 +153,7 @@ namespace mRemoteNG.Connection.Protocol
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace("Couldn't dispose control, probably form is already closed (Connection.Protocol.Base)", ex);
Runtime.MessageCollector?.AddExceptionStackTrace("Couldn't dispose control, probably form is already closed (Connection.Protocol.Base)", ex);
}
}
@@ -172,12 +172,12 @@ namespace mRemoteNG.Connection.Protocol
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace("Couldn't set InterfaceControl.Parent.Tag or Dispose Interface, probably form is already closed (Connection.Protocol.Base)", ex);
Runtime.MessageCollector?.AddExceptionStackTrace("Couldn't set InterfaceControl.Parent.Tag or Dispose Interface, probably form is already closed (Connection.Protocol.Base)", ex);
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace("Couldn't Close InterfaceControl BG (Connection.Protocol.Base)", ex);
Runtime.MessageCollector?.AddExceptionStackTrace("Couldn't Close InterfaceControl BG (Connection.Protocol.Base)", ex);
}
}

View File

@@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// <Assembly: AssemblyVersion("1.0.*")>
[assembly: AssemblyVersion("1.75.7009.*")]
[assembly: AssemblyVersion("1.75.7011.*")]
[assembly:NeutralResourcesLanguageAttribute("en")]

View File

@@ -60,6 +60,15 @@ namespace mRemoteNG {
}
}
/// <summary>
/// Looks up a localized string similar to Could not find external tool with name &quot;{0}&quot;.
/// </summary>
internal static string CouldNotFindExternalTool {
get {
return ResourceManager.GetString("CouldNotFindExternalTool", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to About.
/// </summary>

View File

@@ -2433,4 +2433,7 @@ mRemoteNG will now quit and begin with the installation.</value>
<data name="strPropertyNameRDPAlertIdleTimeout" xml:space="preserve">
<value>Alert on Idle Disconnect</value>
</data>
<data name="CouldNotFindExternalTool" xml:space="preserve">
<value>Could not find external tool with name "{0}"</value>
</data>
</root>

View File

@@ -105,7 +105,7 @@ namespace mRemoteNG.Tools
private void SetConnectionInfoFields(ConnectionInfo newConnectionInfo)
{
newConnectionInfo.Protocol = ProtocolType.IntApp;
newConnectionInfo.ExtApp = FileName;
newConnectionInfo.ExtApp = DisplayName;
newConnectionInfo.Name = DisplayName;
newConnectionInfo.Panel = Language.strMenuExternalTools;
}

View File

@@ -60,9 +60,13 @@ namespace mRemoteNG.UI.Controls
Opening += (sender, args) =>
{
AddExternalApps();
if (_connectionTree.SelectedNode == null)
{
args.Cancel = true;
return;
}
ShowHideMenuItems();
};
Closing += (sender, args) => EnableMenuItemsRecursive(Items);
}
private void InitializeComponent()
@@ -397,9 +401,6 @@ namespace mRemoteNG.UI.Controls
internal void ShowHideMenuItems()
{
if (_connectionTree.SelectedNode == null)
return;
try
{
Enabled = true;
@@ -443,7 +444,9 @@ namespace mRemoteNG.UI.Controls
_cMenTreeToolsSort.Enabled = false;
_cMenTreeToolsExternalApps.Enabled = false;
_cMenTreeDuplicate.Enabled = false;
_cMenTreeRename.Enabled = true;
_cMenTreeImport.Enabled = false;
_cMenTreeExportFile.Enabled = false;
_cMenTreeRename.Enabled = false;
_cMenTreeDelete.Enabled = false;
_cMenTreeMoveUp.Enabled = false;
_cMenTreeMoveDown.Enabled = false;
@@ -498,6 +501,8 @@ namespace mRemoteNG.UI.Controls
_cMenTreeDelete.Enabled = false;
_cMenTreeMoveUp.Enabled = false;
_cMenTreeMoveDown.Enabled = false;
_cMenTreeImport.Enabled = false;
_cMenTreeExportFile.Enabled = false;
}
internal void ShowHideMenuItemsForConnectionNode(ConnectionInfo connectionInfo)

View File

@@ -15,13 +15,14 @@ using mRemoteNG.Tree.Root;
namespace mRemoteNG.UI.Controls
{
public partial class ConnectionTree : TreeListView, IConnectionTree
public partial class ConnectionTree : TreeListView, IConnectionTree
{
private ConnectionTreeModel _connectionTreeModel;
private readonly ConnectionTreeDragAndDropHandler _dragAndDropHandler = new ConnectionTreeDragAndDropHandler();
private readonly PuttySessionsManager _puttySessionsManager = PuttySessionsManager.Instance;
private bool _nodeInEditMode;
private bool _allowEdit;
private bool _isUpdatingColumnWidth;
private ConnectionContextMenu _contextMenu;
public ConnectionInfo SelectedNode => (ConnectionInfo) SelectedObject;
@@ -60,6 +61,8 @@ namespace mRemoteNG.UI.Controls
SmallImageList = imageList.GetImageList();
AddColumns(imageList.ImageGetter);
LinkModelToView();
_contextMenu = new ConnectionContextMenu(this);
ContextMenuStrip = _contextMenu;
SetupDropSink();
SetEventHandlers();
}
@@ -94,39 +97,53 @@ namespace mRemoteNG.UI.Controls
var container = args.Model as ContainerInfo;
if (container == null) return;
container.IsExpanded = false;
UpdateColumnWidth();
};
AutoResizeColumn(Columns[0]);
};
Expanded += (sender, args) =>
{
var container = args.Model as ContainerInfo;
if (container == null) return;
container.IsExpanded = true;
UpdateColumnWidth();
};
SizeChanged += OnSizeChanged;
AutoResizeColumn(Columns[0]);
};
SelectionChanged += tvConnections_AfterSelect;
MouseDoubleClick += OnMouse_DoubleClick;
MouseClick += OnMouse_SingleClick;
CellToolTipShowing += tvConnections_CellToolTipShowing;
ModelCanDrop += _dragAndDropHandler.HandleEvent_ModelCanDrop;
ModelDropped += _dragAndDropHandler.HandleEvent_ModelDropped;
BeforeLabelEdit += HandleCheckForValidEdit;
BeforeLabelEdit += OnBeforeLabelEdit;
AfterLabelEdit += OnAfterLabelEdit;
}
private void OnSizeChanged(object o, EventArgs eventArgs)
{
if (_isUpdatingColumnWidth)
return;
UpdateColumnWidth();
}
/// <summary>
/// Resizes the given column to ensure that all content is shown
/// </summary>
private void AutoResizeColumn(ColumnHeader column)
{
if (InvokeRequired)
{
Invoke((MethodInvoker) (() => AutoResizeColumn(column)));
return;
}
private void UpdateColumnWidth()
{
_isUpdatingColumnWidth = true;
AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
Columns[0].Width += SmallImageSize.Width;
_isUpdatingColumnWidth = false;
}
var longestIndentationAndTextWidth = int.MinValue;
var horizontalScrollOffset = LowLevelScrollPosition.X;
const int padding = 10;
for (var i = 0; i < Items.Count; i++)
{
var rowIndentation = Items[i].Position.X;
var rowTextWidth = TextRenderer.MeasureText(Items[i].Text, Font).Width;
longestIndentationAndTextWidth = Math.Max(rowIndentation + rowTextWidth, longestIndentationAndTextWidth);
}
column.Width = longestIndentationAndTextWidth +
SmallImageSize.Width +
horizontalScrollOffset +
padding;
}
private void PopulateTreeView()
{
@@ -135,7 +152,8 @@ namespace mRemoteNG.UI.Controls
RegisterModelUpdateHandlers();
NodeSearcher = new NodeSearcher(ConnectionTreeModel);
ExecutePostSetupActions();
}
AutoResizeColumn(Columns[0]);
}
private void RegisterModelUpdateHandlers()
{
@@ -167,8 +185,8 @@ namespace mRemoteNG.UI.Controls
return;
RefreshObject(senderAsConnectionInfo);
UpdateColumnWidth();
}
AutoResizeColumn(Columns[0]);
}
private void ExecutePostSetupActions()
{
@@ -250,20 +268,6 @@ namespace mRemoteNG.UI.Controls
{
_allowEdit = true;
SelectedItem.BeginEdit();
Runtime.SaveConnectionsAsync();
}
public void HandleCheckForValidEdit(object sender, LabelEditEventArgs e)
{
if (!(sender is ConnectionTree)) return;
if (_allowEdit)
{
_allowEdit = false;
}
else
{
e.CancelEdit = true;
}
}
public void DeleteSelectedNode()
@@ -277,8 +281,8 @@ namespace mRemoteNG.UI.Controls
private void HandleCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
{
RefreshObject(sender);
UpdateColumnWidth();
}
AutoResizeColumn(Columns[0]);
}
private void tvConnections_AfterSelect(object sender, EventArgs e)
{
@@ -297,7 +301,7 @@ namespace mRemoteNG.UI.Controls
if (mouseEventArgs.Clicks < 2) return;
OLVColumn column;
var listItem = GetItemAt(mouseEventArgs.X, mouseEventArgs.Y, out column);
var clickedNode = listItem.RowObject as ConnectionInfo;
var clickedNode = listItem?.RowObject as ConnectionInfo;
if (clickedNode == null) return;
DoubleClickHandler.Execute(clickedNode);
}
@@ -324,6 +328,41 @@ namespace mRemoteNG.UI.Controls
Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_MouseMove (UI.Window.ConnectionTreeWindow) failed", ex);
}
}
private void OnBeforeLabelEdit(object sender, LabelEditEventArgs e)
{
if (_nodeInEditMode || !(sender is ConnectionTree))
return;
if (!_allowEdit || SelectedNode is PuttySessionInfo || SelectedNode is RootPuttySessionsNodeInfo)
{
e.CancelEdit = true;
return;
}
_nodeInEditMode = true;
_contextMenu.DisableShortcutKeys();
}
private void OnAfterLabelEdit(object sender, LabelEditEventArgs e)
{
if (!_nodeInEditMode)
return;
try
{
_contextMenu.EnableShortcutKeys();
ConnectionTreeModel.RenameNode(SelectedNode, e.Label);
_nodeInEditMode = false;
_allowEdit = false;
Windows.ConfigForm.SelectedTreeNode = SelectedNode;
Runtime.SaveConnectionsAsync();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_AfterLabelEdit (UI.Window.ConnectionTreeWindow) failed", ex);
}
}
#endregion
}
}

View File

@@ -12,6 +12,7 @@ namespace mRemoteNG.UI.Controls
FillsFreeSpace = false;
AspectGetter = item => ((ConnectionInfo) item).Name;
ImageGetter = imageGetterDelegate;
AutoCompleteEditor = false;
}
}
}

View File

@@ -204,6 +204,9 @@ namespace mRemoteNG.UI.Forms
Runtime.NewConnections(Runtime.GetStartupConnectionFileName());
}
if (Settings.Default.ResetPanels)
SetDefaultLayout();
Runtime.LoadConnections();
Windows.TreePanel.Focus();

View File

@@ -476,7 +476,9 @@ namespace mRemoteNG.UI.Window
_pGrid.SelectedObject = propertyGridObject;
_btnShowProperties.Enabled = true;
_btnShowInheritance.Enabled = gridObjectAsContainerInfo.Parent != null;
_btnShowInheritance.Enabled =
gridObjectAsContainerInfo.Parent != null &&
!(gridObjectAsContainerInfo.Parent is RootNodeInfo);
_btnShowDefaultProperties.Enabled = false;
_btnShowDefaultInheritance.Enabled = false;
_btnIcon.Enabled = true;
@@ -492,7 +494,10 @@ namespace mRemoteNG.UI.Window
_pGrid.SelectedObject = propertyGridObject;
_btnShowProperties.Enabled = true;
_btnShowInheritance.Enabled = gridObjectAsConnectionInfo.Parent != null;
_btnShowInheritance.Enabled =
!(gridObjectAsConnectionInfo is PuttySessionInfo) &&
gridObjectAsConnectionInfo.Parent != null &&
!(gridObjectAsConnectionInfo.Parent is RootNodeInfo);
_btnShowDefaultProperties.Enabled = false;
_btnShowDefaultInheritance.Enabled = false;
_btnIcon.Enabled = true;

View File

@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using mRemoteNG.Tree.Root;
using mRemoteNG.UI.Controls;
using WeifenLuo.WinFormsUI.Docking;
@@ -15,10 +16,8 @@ namespace mRemoteNG.UI.Window
{
public partial class ConnectionTreeWindow
{
private readonly ConnectionContextMenu _contextMenu;
private readonly IConnectionInitiator _connectionInitiator = new ConnectionInitiator();
public ConnectionInfo SelectedNode => olvConnections.SelectedNode;
public ConnectionTree ConnectionTree
@@ -32,8 +31,6 @@ namespace mRemoteNG.UI.Window
WindowType = WindowType.Tree;
DockPnl = panel;
InitializeComponent();
_contextMenu = new ConnectionContextMenu(olvConnections);
olvConnections.ContextMenuStrip = _contextMenu;
SetMenuEventHandlers();
SetConnectionTreeEventHandlers();
Settings.Default.PropertyChanged += (sender, args) => SetConnectionTreeEventHandlers();
@@ -84,8 +81,6 @@ namespace mRemoteNG.UI.Window
private void SetConnectionTreeEventHandlers()
{
olvConnections.NodeDeletionConfirmer = new SelectedConnectionDeletionConfirmer(olvConnections, MessageBox.Show);
olvConnections.BeforeLabelEdit += tvConnections_BeforeLabelEdit;
olvConnections.AfterLabelEdit += tvConnections_AfterLabelEdit;
olvConnections.KeyDown += tvConnections_KeyDown;
olvConnections.KeyPress += tvConnections_KeyPress;
SetTreePostSetupActions();
@@ -171,26 +166,6 @@ namespace mRemoteNG.UI.Window
Runtime.SaveConnectionsAsync();
}
private void tvConnections_BeforeLabelEdit(object sender, LabelEditEventArgs e)
{
_contextMenu.DisableShortcutKeys();
}
private void tvConnections_AfterLabelEdit(object sender, LabelEditEventArgs e)
{
try
{
_contextMenu.EnableShortcutKeys();
ConnectionTree.ConnectionTreeModel.RenameNode(SelectedNode, e.Label);
Windows.ConfigForm.SelectedTreeNode = SelectedNode;
Runtime.SaveConnectionsAsync();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionStackTrace("tvConnections_AfterLabelEdit (UI.Window.ConnectionTreeWindow) failed", ex);
}
}
#endregion
#region Search