mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Refactored to reduce coupling
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user