mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Compare commits
25 Commits
v1.75.7009
...
v1.75.7011
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f63980f122 | ||
|
|
9cee827f6b | ||
|
|
9c57976906 | ||
|
|
ef5b09b6fa | ||
|
|
469b4224dc | ||
|
|
afc410cfe6 | ||
|
|
aed509155b | ||
|
|
0120762dbe | ||
|
|
85b67ecd0b | ||
|
|
7451383c24 | ||
|
|
88d735ed56 | ||
|
|
7a002e4b89 | ||
|
|
01ad0b4875 | ||
|
|
4defa5fa9c | ||
|
|
5ce8171f12 | ||
|
|
e3121cb043 | ||
|
|
99e52ab0b5 | ||
|
|
2b672dc4fc | ||
|
|
6db7adf900 | ||
|
|
65782285a3 | ||
|
|
64bd5a93ad | ||
|
|
68f052efcb | ||
|
|
4a8baf79fb | ||
|
|
499ac0295e | ||
|
|
29c422501a |
@@ -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:
|
||||
|
||||
57
mRemoteNGTests/Connection/Protocol/IntegratedProgramTests.cs
Normal file
57
mRemoteNGTests/Connection/Protocol/IntegratedProgramTests.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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")]
|
||||
|
||||
|
||||
@@ -60,6 +60,15 @@ namespace mRemoteNG {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Could not find external tool with name "{0}".
|
||||
/// </summary>
|
||||
internal static string CouldNotFindExternalTool {
|
||||
get {
|
||||
return ResourceManager.GetString("CouldNotFindExternalTool", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to About.
|
||||
/// </summary>
|
||||
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ namespace mRemoteNG.UI.Controls
|
||||
FillsFreeSpace = false;
|
||||
AspectGetter = item => ((ConnectionInfo) item).Name;
|
||||
ImageGetter = imageGetterDelegate;
|
||||
AutoCompleteEditor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,6 +204,9 @@ namespace mRemoteNG.UI.Forms
|
||||
Runtime.NewConnections(Runtime.GetStartupConnectionFileName());
|
||||
}
|
||||
|
||||
if (Settings.Default.ResetPanels)
|
||||
SetDefaultLayout();
|
||||
|
||||
Runtime.LoadConnections();
|
||||
|
||||
Windows.TreePanel.Focus();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user