From 256b113097e2c66211d62a5e409d375710daea6a Mon Sep 17 00:00:00 2001 From: mrsoundless Date: Tue, 3 May 2011 16:41:01 +0000 Subject: [PATCH] Weird RemoveInventory fix git-svn-id: https://lsleditor.svn.sourceforge.net/svnroot/lsleditor@36 3f4676ac-adda-40fd-8265-58d1435b1672 --- trunk/Solution/SolutionExplorer.cs | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/trunk/Solution/SolutionExplorer.cs b/trunk/Solution/SolutionExplorer.cs index 91ccd2e..9a1125c 100644 --- a/trunk/Solution/SolutionExplorer.cs +++ b/trunk/Solution/SolutionExplorer.cs @@ -1992,6 +1992,28 @@ namespace LSLEditor.Solution return typeSL; } + private delegate void DelegateRemoveInventory(Guid guid, SecondLife.String name); + public void RemoveInventory(Guid guid, SecondLife.String name) + { + if (this.treeView1.InvokeRequired) + { + this.treeView1.Invoke(new DelegateRemoveInventory(RemoveInventory), new object[] { guid, name }); + return; + } + + TreeNode treeNode = FindGuid(this.treeView1.TopNode, guid); + if (treeNode == null) + return; + TreeNode parent = treeNode.Parent; + for (int i = 0; i < parent.Nodes.Count; ++i) + { + if (parent.Nodes[i].Text == name) + { + parent.Nodes.RemoveAt(i); + return; + } + } + } private delegate string DelegateGetInventoryName(Guid guid, int type, int number); public string GetInventoryName(Guid guid, int type, int number) { @@ -2185,7 +2207,6 @@ namespace LSLEditor.Solution return Guid.Empty; // no objects found } - private void GetScriptsFromNode(TreeNode treeNode, List list, bool recursive) { foreach (TreeNode tn in treeNode.Nodes) @@ -2420,19 +2441,6 @@ namespace LSLEditor.Solution break; } } - - public delegate void RemoveInventoryDelegate(Guid guid, SecondLife.String name); - public void RemoveInventory(Guid guid, SecondLife.String name) - { - - if (this.treeView1.InvokeRequired) - this.treeView1.Invoke(new RemoveInventoryDelegate(RemoveInventory), new object[] { guid, name }); - - TreeNode treeNode = FindGuid(this.treeView1.TopNode, guid); - if (treeNode == null) - return; - treeNode.Remove(); - } } public class NodeSorter : System.Collections.IComparer {