Browse Source

Fix #1804: ArgumentException when clicking on ResourcesFileTreeNode.

Removed unused UI elements.
pull/1820/head
Siegfried Pammer 6 years ago
parent
commit
40a9aa4ce0
  1. 8
      ILSpy/Controls/ResourceObjectTable.xaml.cs
  2. 8
      ILSpy/Controls/ResourceStringTable.xaml.cs
  3. 2
      ILSpy/MainWindow.xaml
  4. 6
      ILSpy/MainWindow.xaml.cs
  5. 4
      ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs

8
ILSpy/Controls/ResourceObjectTable.xaml.cs

@ -29,13 +29,13 @@ namespace ICSharpCode.ILSpy.Controls
/// </summary> /// </summary>
public partial class ResourceObjectTable : UserControl public partial class ResourceObjectTable : UserControl
{ {
public ResourceObjectTable(IEnumerable resources, ContentPresenter contentPresenter) public ResourceObjectTable(IEnumerable resources, FrameworkElement container)
{ {
InitializeComponent(); InitializeComponent();
// set size to fit decompiler window // set size to fit decompiler window
contentPresenter.SizeChanged += OnParentSizeChanged; container.SizeChanged += OnParentSizeChanged;
Width = contentPresenter.ActualWidth - 45; Width = container.ActualWidth - 45;
MaxHeight = contentPresenter.ActualHeight; MaxHeight = container.ActualHeight;
resourceListView.ItemsSource = resources; resourceListView.ItemsSource = resources;
} }

8
ILSpy/Controls/ResourceStringTable.xaml.cs

@ -29,13 +29,13 @@ namespace ICSharpCode.ILSpy.Controls
/// </summary> /// </summary>
public partial class ResourceStringTable : UserControl public partial class ResourceStringTable : UserControl
{ {
public ResourceStringTable(IEnumerable strings, ContentPresenter contentPresenter) public ResourceStringTable(IEnumerable strings, FrameworkElement container)
{ {
InitializeComponent(); InitializeComponent();
// set size to fit decompiler window // set size to fit decompiler window
contentPresenter.SizeChanged += OnParentSizeChanged; container.SizeChanged += OnParentSizeChanged;
Width = contentPresenter.ActualWidth - 45; Width = container.ActualWidth - 45;
MaxHeight = contentPresenter.ActualHeight; MaxHeight = container.ActualHeight;
resourceListView.ItemsSource = strings; resourceListView.ItemsSource = strings;
} }

2
ILSpy/MainWindow.xaml

@ -56,8 +56,6 @@
<ContentControl Content="{StaticResource AnalyzerTreeView}" /> <ContentControl Content="{StaticResource AnalyzerTreeView}" />
</DataTemplate> </DataTemplate>
<ContentPresenter x:Key="MainPane" />
<DataTemplate x:Key="DecompilerTextViewTemplate"> <DataTemplate x:Key="DecompilerTextViewTemplate">
<textview:DecompilerTextView DataContext="{Binding}" /> <textview:DecompilerTextView DataContext="{Binding}" />
</DataTemplate> </DataTemplate>

6
ILSpy/MainWindow.xaml.cs

@ -83,12 +83,6 @@ namespace ICSharpCode.ILSpy
get { return sessionSettings; } get { return sessionSettings; }
} }
public ContentPresenter mainPane {
get {
return FindResource("MainPane") as ContentPresenter;
}
}
public SharpTreeView treeView { public SharpTreeView treeView {
get { get {
return FindResource("TreeView") as SharpTreeView; return FindResource("TreeView") as SharpTreeView;

4
ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs

@ -149,7 +149,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
if (null != smartOutput) { if (null != smartOutput) {
smartOutput.AddUIElement( smartOutput.AddUIElement(
delegate { delegate {
return new ResourceStringTable(stringTableEntries, MainWindow.Instance.mainPane); return new ResourceStringTable(stringTableEntries, Docking.DockWorkspace.Instance.GetTextView());
} }
); );
} }
@ -161,7 +161,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
if (null != smartOutput) { if (null != smartOutput) {
smartOutput.AddUIElement( smartOutput.AddUIElement(
delegate { delegate {
return new ResourceObjectTable(otherEntries, MainWindow.Instance.mainPane); return new ResourceObjectTable(otherEntries, Docking.DockWorkspace.Instance.GetTextView());
} }
); );
} }

Loading…
Cancel
Save