Refactored to reduce coupling

This commit is contained in:
David Sparer
2016-08-22 16:05:49 -06:00
parent 020433d7ad
commit 8f685faf9b
3 changed files with 12 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ using mRemoteNG.Tree;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using mRemoteNG.App;
namespace mRemoteNG.Config.Putty
@@ -11,10 +12,9 @@ namespace mRemoteNG.Config.Putty
public class Sessions
{
#region Public Methods
private delegate void AddSessionsToTreeDelegate();
public static void AddSessionsToTree()
private delegate void AddSessionsToTreeDelegate(TreeView treeView);
public static void AddSessionsToTree(TreeView treeView)
{
TreeView treeView = ConnectionTree.TreeView;
if (treeView == null)
{
return ;
@@ -139,7 +139,7 @@ namespace mRemoteNG.Config.Putty
public static void SessionChanged(object sender, Provider.SessionChangedEventArgs e)
{
AddSessionsToTree();
AddSessionsToTree(Windows.treeForm.tvConnections);
}
#endregion

View File

@@ -80,7 +80,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
if (puttyPathChanged)
{
PuttyBase.PuttyPath = Settings.Default.UseCustomPuttyPath ? Settings.Default.CustomPuttyPath : GeneralAppInfo.PuttyPath;
Sessions.AddSessionsToTree();
Sessions.AddSessionsToTree(Windows.treeForm.tvConnections);
}
Settings.Default.MaxPuttyWaitTime = (int) numPuttyWaitTime.Value;

View File

@@ -909,7 +909,13 @@ namespace mRemoteNG.UI.Window
public void txtSearch_TextChanged(object sender, EventArgs e)
{
tvConnections.SelectedNode = ConnectionTree.Find(tvConnections.Nodes[0], txtSearch.Text);
try
{
tvConnections.SelectedNode = ConnectionTree.Find(tvConnections.Nodes[0], txtSearch.Text);
}
catch (Exception)
{
}
}
public void tvConnections_KeyPress(object sender, KeyPressEventArgs e)