Weird RemoveInventory fix

git-svn-id: https://lsleditor.svn.sourceforge.net/svnroot/lsleditor@36 3f4676ac-adda-40fd-8265-58d1435b1672
This commit is contained in:
mrsoundless 2011-05-03 16:41:01 +00:00
parent 90c56020d4
commit 256b113097

View file

@ -1992,6 +1992,28 @@ namespace LSLEditor.Solution
return typeSL; 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); private delegate string DelegateGetInventoryName(Guid guid, int type, int number);
public string GetInventoryName(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 return Guid.Empty; // no objects found
} }
private void GetScriptsFromNode(TreeNode treeNode, List<Guid> list, bool recursive) private void GetScriptsFromNode(TreeNode treeNode, List<Guid> list, bool recursive)
{ {
foreach (TreeNode tn in treeNode.Nodes) foreach (TreeNode tn in treeNode.Nodes)
@ -2420,19 +2441,6 @@ namespace LSLEditor.Solution
break; 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 public class NodeSorter : System.Collections.IComparer
{ {