Hello haleyjason,
thanks for your response.
I’m doing the explicit cast of the TreeView
Anyway, I prefer to show you the entire code
Note: This project have 2 main items.
1 - Package Class: To comunicate with the Reflector
2 - MethodForm:
Package Class
internal class MethodDependencyPackage : IPackage
{
private IWindowManager windowManager;
private ICommandBarManager commandBarManager;
private ICommandBarSeparator separator;
private ICommandBarButton button;
public void Load(IServiceProvider serviceProvider)
{
MethodDependencyWindow methodDependencyWindow = new MethodDependencyWindow();
this.windowManager = (IWindowManager)serviceProvider.GetService(typeof(IWindowManager));
this.windowManager.Windows.Add("MethodDependencyWindow", methodDependencyWindow, "Method Dependency");
//obtengo la ventana de Analyzer
methodDependencyWindow.windowsAnalyzer = this.windowManager.Windows["AnalyzerWindow"];
this.commandBarManager = (ICommandBarManager)serviceProvider.GetService(typeof(ICommandBarManager));
this.separator = this.commandBarManager.CommandBars["Tools"].Items.AddSeparator();
this.button = this.commandBarManager.CommandBars["Tools"].Items.AddButton("&MethodDependency", new EventHandler(this.MethodDependencyButton_Click));
}
}
}
In this class I get the Analyzer window object. I will need it to get the TreeView and expand it.
When the first node is expanded the MethodDependencyAfterExpand is called and begins the recursion
the problem I see, is that, the second time that the MethodDependencyAfterExpand is called, the actual node (e.Node) has no childNodes (e.Node.Nodes.Count =0 )
windowFormClass
public partial class MethodDependencyWindow : UserControl
{
private IWindow _windowsAnalyzer;
public IWindow windowsAnalyzer
{
get { return _windowsAnalyzer; }
set {
_windowsAnalyzer = value;
TreeView analyzerTreeView = (TreeView)(windowsAnalyzer.Content.Controls[0]);
analyzerTreeView.AfterExpand += new TreeViewEventHandler(this.MethodDependencyAfterExpand);
}
}
private void MethodDependencyAfterExpand(object sender, TreeViewEventArgs e)
{
System.Threading.Thread.Sleep(2000);
foreach (TreeNode node in e.Node.Nodes)
{
if (node.Parent != null && node.Parent.IsExpanded)
{
node.Expand();
}
}
}
}
Regards,
Nico / comments
- Community
- .Net Reflector 6.x and .NET Reflector 6.x Pro
- Expand All Nodes WindowsAnalyzer TreeView
Hello haleyjason,
thanks for your response.
I’m doing the explicit cast of the TreeView
Anyway, I prefer to show you the entire code
Note: This project have 2 main items.
1 - Package Class: To co...
0 votes