Browse Source

Add "Remove assembly" item in AssemblyTreeNode context menu.

pull/1/head
Eusebiu Marcu 15 years ago
parent
commit
7be3277a1b
  1. 1
      ILSpy/ILSpy.csproj
  2. BIN
      ILSpy/Images/Delete.png
  3. 2
      ILSpy/Images/Images.cs
  4. 29
      ILSpy/TreeNodes/AssemblyTreeNode.cs

1
ILSpy/ILSpy.csproj

@ -109,6 +109,7 @@ @@ -109,6 +109,7 @@
<Resource Include="Images\OK.png" />
<Resource Include="Images\ClearSearch.png" />
<Resource Include="Images\Search.png" />
<Resource Include="Images\Delete.png" />
<None Include="Properties\AssemblyInfo.template.cs" />
<Compile Include="Properties\WPFAssemblyInfo.cs" />
<Compile Include="MainWindow.xaml.cs">

BIN
ILSpy/Images/Delete.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

2
ILSpy/Images/Images.cs

@ -65,5 +65,7 @@ namespace ICSharpCode.ILSpy @@ -65,5 +65,7 @@ namespace ICSharpCode.ILSpy
public static readonly BitmapImage ProtectedEnum = LoadBitmap("ProtectedEnum");
public static readonly BitmapImage ProtectedInterface = LoadBitmap("ProtectedInterface");
public static readonly BitmapImage ProtectedStruct = LoadBitmap("ProtectedStruct");
public static readonly BitmapImage Delete = LoadBitmap("Delete");
}
}

29
ILSpy/TreeNodes/AssemblyTreeNode.cs

@ -24,6 +24,7 @@ using System.Linq; @@ -24,6 +24,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using ICSharpCode.Decompiler;
using ICSharpCode.TreeView;
@ -37,6 +38,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -37,6 +38,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// </summary>
sealed class AssemblyTreeNode : ILSpyTreeNode<ILSpyTreeNodeBase>
{
readonly AssemblyList assemblyList;
readonly string fileName;
string shortName;
@ -44,6 +46,9 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -44,6 +46,9 @@ namespace ICSharpCode.ILSpy.TreeNodes
readonly List<TypeTreeNode> classes = new List<TypeTreeNode>();
readonly Dictionary<string, NamespaceTreeNode> namespaces = new Dictionary<string, NamespaceTreeNode>();
// UI
ContextMenu menu;
public AssemblyTreeNode(string fileName, AssemblyList assemblyList)
{
if (fileName == null)
@ -57,6 +62,8 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -57,6 +62,8 @@ namespace ICSharpCode.ILSpy.TreeNodes
assemblyTask.ContinueWith(OnAssemblyLoaded, TaskScheduler.FromCurrentSynchronizationContext());
this.LazyLoading = true;
CreateRemoveItemContextMenu();
}
public string FileName {
@ -122,6 +129,20 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -122,6 +129,20 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
}
void CreateRemoveItemContextMenu()
{
var menu = GetContextMenu();
MenuItem item = new MenuItem() {
Header = "Remove assembly",
Icon = new Image() { Source = Images.Delete }
};
item.Click += delegate { Delete(); };
menu.Items.Add(item);
}
sealed class MyAssemblyResolver : IAssemblyResolver
{
readonly AssemblyTreeNode parent;
@ -156,6 +177,14 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -156,6 +177,14 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
}
public override ContextMenu GetContextMenu()
{
if (menu != null)
return menu;
return (menu = new ContextMenu());
}
protected override void LoadChildren()
{
try {

Loading…
Cancel
Save