Skip to content

Commit

Permalink
Prototype ITreeNodeImagesProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwille committed Jul 23, 2024
1 parent 52256fd commit 946f24f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ILSpy/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
using ICSharpCode.ILSpy.Options;
using ICSharpCode.ILSpyX.Analyzers;
using ICSharpCode.ILSpyX.Settings;
using ICSharpCode.TreeView;

using Medo.Application;

Expand Down Expand Up @@ -75,6 +76,8 @@ public App()
SingleInstance.NewInstanceDetected += SingleInstance_NewInstanceDetected;
}

SharpTreeNode.ImagesProvider = new WpfWindowsTreeNodeImagesProvider();

InitializeComponent();

Resources.RegisterDefaultStyles();
Expand Down
9 changes: 9 additions & 0 deletions ILSpy/Images/WpfWindowsTreeNodeImagesProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using ICSharpCode.TreeView.PlatformAbstractions;

namespace ICSharpCode.ILSpy
{
public class WpfWindowsTreeNodeImagesProvider : ITreeNodeImagesProvider
{
public object Assembly => Images.Assembly;
}
}
4 changes: 3 additions & 1 deletion ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.TreeView.PlatformAbstractions;

using TomsToolbox.Wpf.Controls;

namespace ICSharpCode.ILSpy.TreeNodes
{
/// <summary>
Expand All @@ -49,7 +51,7 @@ public override object Text {
get { return Language.EscapeName(r.Name) + GetSuffixString(r.Handle); }
}

public override object Icon => Images.Assembly;
public override object Icon => ImagesProvider.Assembly;

public override bool ShowExpander {
get {
Expand Down
7 changes: 7 additions & 0 deletions SharpTreeView/PlatformAbstractions/ITreeNodeImagesProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace ICSharpCode.TreeView.PlatformAbstractions
{
public interface ITreeNodeImagesProvider
{
object Assembly { get; }
}
}
2 changes: 2 additions & 0 deletions SharpTreeView/SharpTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ namespace ICSharpCode.TreeView
{
public partial class SharpTreeNode : INotifyPropertyChanged
{
public static ITreeNodeImagesProvider ImagesProvider { get; set; }

SharpTreeNodeCollection modelChildren;
internal SharpTreeNode modelParent;
bool isVisible = true;
Expand Down

0 comments on commit 946f24f

Please sign in to comment.