Browse Source

Adjust ILSpy to SharpTreeView changes.

pull/10/head
Daniel Grunwald 14 years ago
parent
commit
7f45c26f6d
  1. 8
      ILSpy/AssemblyList.cs
  2. 8
      ILSpy/MainWindow.xaml.cs
  3. 8
      ILSpy/TextView/DecompilerTextView.cs
  4. 4
      ILSpy/TreeNodes/AssemblyListTreeNode.cs
  5. 2
      ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs
  6. 2
      ILSpy/TreeNodes/AssemblyTreeNode.cs
  7. 8
      ILSpy/TreeNodes/BaseTypesTreeNode.cs
  8. 4
      ILSpy/TreeNodes/DerivedTypesTreeNode.cs
  9. 2
      ILSpy/TreeNodes/EventTreeNode.cs
  10. 2
      ILSpy/TreeNodes/FieldTreeNode.cs
  11. 133
      ILSpy/TreeNodes/ILSpyTreeNode.cs
  12. 2
      ILSpy/TreeNodes/MethodTreeNode.cs
  13. 2
      ILSpy/TreeNodes/ModuleReferenceTreeNode.cs
  14. 4
      ILSpy/TreeNodes/NamespaceTreeNode.cs
  15. 2
      ILSpy/TreeNodes/PropertyTreeNode.cs
  16. 4
      ILSpy/TreeNodes/ReferenceFolderTreeNode.cs
  17. 6
      ILSpy/TreeNodes/ResourceListTreeNode.cs
  18. 20
      ILSpy/TreeNodes/ThreadedTreeNode.cs
  19. 2
      ILSpy/TreeNodes/TypeTreeNode.cs

8
ILSpy/AssemblyList.cs

@ -44,6 +44,10 @@ namespace ICSharpCode.ILSpy @@ -44,6 +44,10 @@ namespace ICSharpCode.ILSpy
/// Needs locking for multi-threaded access!
/// Write accesses are allowed on the GUI thread only (but still need locking!)
/// </summary>
/// <remarks>
/// Technically read accesses need locking on when done on non-GUI threads... but whenever possible, use the
/// thread-safe <see cref="GetAssemblies()"/> method.
/// </remarks>
internal readonly ObservableCollection<AssemblyTreeNode> assemblies = new ObservableCollection<AssemblyTreeNode>();
/// <summary>
@ -167,10 +171,10 @@ namespace ICSharpCode.ILSpy @@ -167,10 +171,10 @@ namespace ICSharpCode.ILSpy
MethodTreeNode methodNode = typeNode.VisibleChildren.OfType<MethodTreeNode>().FirstOrDefault(m => m.MethodDefinition == def);
if (methodNode != null)
return methodNode;
foreach (var p in typeNode.VisibleChildren.OfType<ILSpyTreeNode<MethodTreeNode>>()) {
foreach (var p in typeNode.VisibleChildren.OfType<ILSpyTreeNode>()) {
// method might be a child or a property or events
p.EnsureLazyChildren();
methodNode = p.Children.FirstOrDefault(m => m.MethodDefinition == def);
methodNode = p.Children.OfType<MethodTreeNode>().FirstOrDefault(m => m.MethodDefinition == def);
if (methodNode != null)
return methodNode;
}

8
ILSpy/MainWindow.xaml.cs

@ -372,24 +372,24 @@ namespace ICSharpCode.ILSpy @@ -372,24 +372,24 @@ namespace ICSharpCode.ILSpy
void TreeView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (treeView.SelectedItems.Count == 1) {
ILSpyTreeNodeBase node = treeView.SelectedItem as ILSpyTreeNodeBase;
ILSpyTreeNode node = treeView.SelectedItem as ILSpyTreeNode;
if (node != null && node.View(decompilerTextView))
return;
}
decompilerTextView.Decompile(sessionSettings.FilterSettings.Language,
treeView.GetTopLevelSelection().OfType<ILSpyTreeNodeBase>(),
treeView.GetTopLevelSelection().OfType<ILSpyTreeNode>(),
new DecompilationOptions());
}
void saveCode_Click(object sender, RoutedEventArgs e)
{
if (treeView.SelectedItems.Count == 1) {
ILSpyTreeNodeBase node = treeView.SelectedItem as ILSpyTreeNodeBase;
ILSpyTreeNode node = treeView.SelectedItem as ILSpyTreeNode;
if (node != null && node.Save())
return;
}
decompilerTextView.SaveToDisk(sessionSettings.FilterSettings.Language,
treeView.GetTopLevelSelection().OfType<ILSpyTreeNodeBase>(),
treeView.GetTopLevelSelection().OfType<ILSpyTreeNode>(),
new DecompilationOptions());
}
#endregion

8
ILSpy/TextView/DecompilerTextView.cs

@ -188,7 +188,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -188,7 +188,7 @@ namespace ICSharpCode.ILSpy.TextView
/// Starts the decompilation of the given nodes.
/// The result is displayed in the text view.
/// </summary>
public void Decompile(ILSpy.Language language, IEnumerable<ILSpyTreeNodeBase> treeNodes, DecompilationOptions options)
public void Decompile(ILSpy.Language language, IEnumerable<ILSpyTreeNode> treeNodes, DecompilationOptions options)
{
// Some actions like loading an assembly list cause several selection changes in the tree view,
// and each of those will start a decompilation action.
@ -209,10 +209,10 @@ namespace ICSharpCode.ILSpy.TextView @@ -209,10 +209,10 @@ namespace ICSharpCode.ILSpy.TextView
sealed class DecompilationContext
{
public readonly ILSpy.Language Language;
public readonly ILSpyTreeNodeBase[] TreeNodes;
public readonly ILSpyTreeNode[] TreeNodes;
public readonly DecompilationOptions Options;
public DecompilationContext(ILSpy.Language language, ILSpyTreeNodeBase[] treeNodes, DecompilationOptions options)
public DecompilationContext(ILSpy.Language language, ILSpyTreeNode[] treeNodes, DecompilationOptions options)
{
this.Language = language;
this.TreeNodes = treeNodes;
@ -367,7 +367,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -367,7 +367,7 @@ namespace ICSharpCode.ILSpy.TextView
/// <summary>
/// Shows the 'save file dialog', prompting the user to save the decompiled nodes to disk.
/// </summary>
public void SaveToDisk(ILSpy.Language language, IEnumerable<ILSpyTreeNodeBase> treeNodes, DecompilationOptions options)
public void SaveToDisk(ILSpy.Language language, IEnumerable<ILSpyTreeNode> treeNodes, DecompilationOptions options)
{
if (!treeNodes.Any())
return;

4
ILSpy/TreeNodes/AssemblyListTreeNode.cs

@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// Represents a list of assemblies.
/// This is used as (invisible) root node of the tree view.
/// </summary>
sealed class AssemblyListTreeNode : ILSpyTreeNode<AssemblyTreeNode>
sealed class AssemblyListTreeNode : ILSpyTreeNode
{
readonly AssemblyList assemblyList;
@ -38,11 +38,11 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -38,11 +38,11 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
public AssemblyListTreeNode(AssemblyList assemblyList)
: base(assemblyList.assemblies)
{
if (assemblyList == null)
throw new ArgumentNullException("assemblyList");
this.assemblyList = assemblyList;
this.Children.BindToObservableCollection(assemblyList.assemblies);
}
public override object Text {

2
ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs

@ -27,7 +27,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -27,7 +27,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Node within assembly reference list.
/// </summary>
sealed class AssemblyReferenceTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
sealed class AssemblyReferenceTreeNode : ILSpyTreeNode
{
readonly AssemblyNameReference r;
readonly AssemblyTreeNode parentAssembly;

2
ILSpy/TreeNodes/AssemblyTreeNode.cs

@ -36,7 +36,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -36,7 +36,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// Tree node representing an assembly.
/// This class is responsible for loading both namespace and type nodes.
/// </summary>
sealed class AssemblyTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
sealed class AssemblyTreeNode : ILSpyTreeNode
{
readonly AssemblyList assemblyList;

8
ILSpy/TreeNodes/BaseTypesTreeNode.cs

@ -30,7 +30,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -30,7 +30,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Lists the base types of a class.
/// </summary>
sealed class BaseTypesTreeNode : ILSpyTreeNode<BaseTypesEntryNode>
sealed class BaseTypesTreeNode : ILSpyTreeNode
{
readonly TypeDefinition type;
@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
AddBaseTypes(this.Children, type);
}
internal static void AddBaseTypes(ObservableCollection<BaseTypesEntryNode> children, TypeDefinition type)
internal static void AddBaseTypes(SharpTreeNodeCollection children, TypeDefinition type)
{
if (type.BaseType != null)
children.Add(new BaseTypesEntryNode(type.BaseType, false));
@ -65,13 +65,13 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -65,13 +65,13 @@ namespace ICSharpCode.ILSpy.TreeNodes
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren));
foreach (var child in this.Children) {
foreach (ILSpyTreeNode child in this.Children) {
child.Decompile(language, output, options);
}
}
}
sealed class BaseTypesEntryNode : ILSpyTreeNode<BaseTypesEntryNode>
sealed class BaseTypesEntryNode : ILSpyTreeNode
{
TypeReference tr;
TypeDefinition def;

4
ILSpy/TreeNodes/DerivedTypesTreeNode.cs

@ -34,7 +34,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -34,7 +34,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
get { return Images.SubTypes; }
}
protected override IEnumerable<ILSpyTreeNodeBase> FetchChildren(CancellationToken cancellationToken)
protected override IEnumerable<ILSpyTreeNode> FetchChildren(CancellationToken cancellationToken)
{
// FetchChildren() runs on the main thread; but the enumerator will be consumed on a background thread
var assemblies = list.GetAssemblies().Select(node => node.AssemblyDefinition).Where(asm => asm != null).ToArray();
@ -91,7 +91,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -91,7 +91,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
}
protected override IEnumerable<ILSpyTreeNodeBase> FetchChildren(CancellationToken ct)
protected override IEnumerable<ILSpyTreeNode> FetchChildren(CancellationToken ct)
{
// FetchChildren() runs on the main thread; but the enumerator will be consumed on a background thread
return DerivedTypesTreeNode.FindDerivedTypes(def, assemblies, ct);

2
ILSpy/TreeNodes/EventTreeNode.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -25,7 +25,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Represents an event in the TreeView.
/// </summary>
sealed class EventTreeNode : ILSpyTreeNode<MethodTreeNode>
sealed class EventTreeNode : ILSpyTreeNode
{
readonly EventDefinition ev;

2
ILSpy/TreeNodes/FieldTreeNode.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -25,7 +25,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Represents a field in the TreeView.
/// </summary>
sealed class FieldTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
sealed class FieldTreeNode : ILSpyTreeNode
{
readonly FieldDefinition field;

133
ILSpy/TreeNodes/ILSpyTreeNode.cs

@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Base class of all ILSpy tree nodes.
/// </summary>
abstract class ILSpyTreeNodeBase : SharpTreeNode
abstract class ILSpyTreeNode : SharpTreeNode
{
FilterSettings filterSettings;
@ -44,15 +44,13 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -44,15 +44,13 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
public Language Language {
get { return filterSettings.Language; }
get { return filterSettings != null ? filterSettings.Language : Languages.AllLanguages[0]; }
}
public SharpTreeNodeCollection VisibleChildren {
get { return base.Children; }
}
protected abstract void OnFilterSettingsChanged();
public virtual FilterResult Filter(FilterSettings settings)
{
if (string.IsNullOrEmpty(settings.SearchTerm))
@ -88,85 +86,8 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -88,85 +86,8 @@ namespace ICSharpCode.ILSpy.TreeNodes
{
return false;
}
}
enum FilterResult
{
/// <summary>
/// Hides the node.
/// </summary>
Hidden,
/// <summary>
/// Shows the node (and resets the search term for child nodes).
/// </summary>
Match,
/// <summary>
/// Hides the node only if all children are hidden (and resets the search term for child nodes).
/// </summary>
MatchAndRecurse,
/// <summary>
/// Hides the node only if all children are hidden (doesn't reset the search term for child nodes).
/// </summary>
Recurse
}
/// <summary>
/// Base class for ILSpy tree nodes.
/// </summary>
abstract class ILSpyTreeNode<T> : ILSpyTreeNodeBase where T : ILSpyTreeNodeBase
{
public ILSpyTreeNode()
: this(new ObservableCollection<T>())
{
}
public ILSpyTreeNode(ObservableCollection<T> children)
{
if (children == null)
throw new ArgumentNullException("children");
this.allChildren = children;
children.CollectionChanged += allChildren_CollectionChanged;
}
void allChildren_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
var visibleChildren = this.VisibleChildren;
switch (e.Action) {
case NotifyCollectionChangedAction.Add:
if (e.NewItems.Count == 1 && e.NewStartingIndex == allChildren.Count - 1) {
T newChild = (T)e.NewItems[0];
if (FilterChild(newChild))
visibleChildren.Add(newChild);
break;
} else {
goto default;
}
case NotifyCollectionChangedAction.Remove:
if (e.OldItems.Count == 1) {
visibleChildren.Remove((T)e.OldItems[0]);
break;
} else {
goto default;
}
default:
ResetChildren();
break;
}
}
void ResetChildren()
{
var visibleChildren = this.VisibleChildren;
visibleChildren.Clear();
foreach (T child in allChildren) {
if (FilterChild(child))
visibleChildren.Add(child);
}
}
bool FilterChild(T child)
bool FilterChild(ILSpyTreeNode child)
{
FilterResult r;
if (this.FilterSettings == null)
@ -203,35 +124,29 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -203,35 +124,29 @@ namespace ICSharpCode.ILSpy.TreeNodes
return filterSettings;
}
protected override void OnFilterSettingsChanged()
protected virtual void OnFilterSettingsChanged()
{
var visibleChildren = this.VisibleChildren;
var allChildren = this.Children;
int j = 0;
for (int i = 0; i < allChildren.Count; i++) {
T child = allChildren[i];
if (j < visibleChildren.Count && visibleChildren[j] == child) {
// it was visible before
if (FilterChild(child)) {
j++; // keep it visible
} else {
visibleChildren.RemoveAt(j); // hide it
}
} else {
// it wasn't visible before
if (FilterChild(child)) {
// make it visible
visibleChildren.Insert(j++, child);
}
}
}
RaisePropertyChanged("Text");
}
readonly ObservableCollection<T> allChildren;
public new ObservableCollection<T> Children {
get { return allChildren; }
}
}
enum FilterResult
{
/// <summary>
/// Hides the node.
/// </summary>
Hidden,
/// <summary>
/// Shows the node (and resets the search term for child nodes).
/// </summary>
Match,
/// <summary>
/// Hides the node only if all children are hidden (and resets the search term for child nodes).
/// </summary>
MatchAndRecurse,
/// <summary>
/// Hides the node only if all children are hidden (doesn't reset the search term for child nodes).
/// </summary>
Recurse
}
}

2
ILSpy/TreeNodes/MethodTreeNode.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -26,7 +26,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Tree Node representing a field, method, property, or event.
/// </summary>
sealed class MethodTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
sealed class MethodTreeNode : ILSpyTreeNode
{
MethodDefinition method;

2
ILSpy/TreeNodes/ModuleReferenceTreeNode.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -26,7 +26,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Module reference in ReferenceFolderTreeNode.
/// </summary>
sealed class ModuleReferenceTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
sealed class ModuleReferenceTreeNode : ILSpyTreeNode
{
ModuleReference r;

4
ILSpy/TreeNodes/NamespaceTreeNode.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -25,7 +25,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Namespace node. The loading of the type nodes is handled by the parent AssemblyTreeNode.
/// </summary>
sealed class NamespaceTreeNode : ILSpyTreeNode<TypeTreeNode>
sealed class NamespaceTreeNode : ILSpyTreeNode
{
string name;
@ -58,7 +58,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -58,7 +58,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.DecompileNamespace(name, this.Children.Select(t => t.TypeDefinition), output, options);
language.DecompileNamespace(name, this.Children.OfType<TypeTreeNode>().Select(t => t.TypeDefinition), output, options);
}
}
}

2
ILSpy/TreeNodes/PropertyTreeNode.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -25,7 +25,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Represents a property in the TreeView.
/// </summary>
sealed class PropertyTreeNode : ILSpyTreeNode<MethodTreeNode>
sealed class PropertyTreeNode : ILSpyTreeNode
{
readonly PropertyDefinition property;
readonly bool isIndexer;

4
ILSpy/TreeNodes/ReferenceFolderTreeNode.cs

@ -27,7 +27,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -27,7 +27,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// References folder.
/// </summary>
sealed class ReferenceFolderTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
sealed class ReferenceFolderTreeNode : ILSpyTreeNode
{
readonly ModuleDefinition module;
readonly AssemblyTreeNode parentAssembly;
@ -62,7 +62,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -62,7 +62,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren));
foreach (var child in this.Children) {
foreach (ILSpyTreeNode child in this.Children) {
child.Decompile(language, output, options);
}
}

6
ILSpy/TreeNodes/ResourceListTreeNode.cs

@ -18,7 +18,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -18,7 +18,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Lists the embedded resources in an assembly.
/// </summary>
sealed class ResourceListTreeNode : ILSpyTreeNode<ResourceTreeNode>
sealed class ResourceListTreeNode : ILSpyTreeNode
{
readonly ModuleDefinition module;
@ -53,14 +53,14 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -53,14 +53,14 @@ namespace ICSharpCode.ILSpy.TreeNodes
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren));
foreach (var child in this.Children) {
foreach (ILSpyTreeNode child in this.Children) {
child.Decompile(language, output, options);
output.WriteLine();
}
}
}
class ResourceTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
class ResourceTreeNode : ILSpyTreeNode
{
Resource r;

20
ILSpy/TreeNodes/ThreadedTreeNode.cs

@ -13,9 +13,9 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -13,9 +13,9 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// Node that is lazy-loaded and loads its children on a background thread.
/// </summary>
abstract class ThreadedTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
abstract class ThreadedTreeNode : ILSpyTreeNode
{
Task<List<ILSpyTreeNodeBase>> loadChildrenTask;
Task<List<ILSpyTreeNode>> loadChildrenTask;
public ThreadedTreeNode()
{
@ -32,7 +32,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -32,7 +32,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// <summary>
/// FetchChildren() runs on the main thread; but the enumerator is consumed on a background thread
/// </summary>
protected abstract IEnumerable<ILSpyTreeNodeBase> FetchChildren(CancellationToken ct);
protected abstract IEnumerable<ILSpyTreeNode> FetchChildren(CancellationToken ct);
protected override sealed void LoadChildren()
{
@ -41,15 +41,15 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -41,15 +41,15 @@ namespace ICSharpCode.ILSpy.TreeNodes
CancellationToken ct = CancellationToken.None;
var fetchChildrenEnumerable = FetchChildren(ct);
Task<List<ILSpyTreeNodeBase>> thisTask = null;
thisTask = new Task<List<ILSpyTreeNodeBase>>(
Task<List<ILSpyTreeNode>> thisTask = null;
thisTask = new Task<List<ILSpyTreeNode>>(
delegate {
List<ILSpyTreeNodeBase> result = new List<ILSpyTreeNodeBase>();
foreach (ILSpyTreeNodeBase child in fetchChildrenEnumerable) {
List<ILSpyTreeNode> result = new List<ILSpyTreeNode>();
foreach (ILSpyTreeNode child in fetchChildrenEnumerable) {
ct.ThrowIfCancellationRequested();
result.Add(child);
App.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action<ILSpyTreeNodeBase>(
delegate (ILSpyTreeNodeBase newChild) {
App.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action<ILSpyTreeNode>(
delegate (ILSpyTreeNode newChild) {
// don't access "child" here the background thread might already be running
// the next loop iteration
if (loadChildrenTask == thisTask) {
@ -86,7 +86,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -86,7 +86,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
}
sealed class LoadingTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
sealed class LoadingTreeNode : ILSpyTreeNode
{
public override object Text {
get { return "Loading..."; }

2
ILSpy/TreeNodes/TypeTreeNode.cs

@ -26,7 +26,7 @@ using Mono.Cecil; @@ -26,7 +26,7 @@ using Mono.Cecil;
namespace ICSharpCode.ILSpy.TreeNodes
{
sealed class TypeTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
sealed class TypeTreeNode : ILSpyTreeNode
{
readonly TypeDefinition type;
readonly AssemblyTreeNode parentAssemblyNode;

Loading…
Cancel
Save