Skip to content

Commit

Permalink
Fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-englert committed Sep 3, 2024
1 parent 4e8566e commit d7b6ba4
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 42 deletions.
60 changes: 32 additions & 28 deletions ILSpy/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>

<Window
x:Class="ICSharpCode.ILSpy.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tv="clr-namespace:ICSharpCode.ILSpy.Controls.TreeView"
xmlns:local="clr-namespace:ICSharpCode.ILSpy"
xmlns:avalondock="https://github.com/Dirkster99/AvalonDock"
xmlns:controls="clr-namespace:ICSharpCode.ILSpy.Controls"
xmlns:docking="clr-namespace:ICSharpCode.ILSpy.Docking"
xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties"
Title="ILSpy"
MinWidth="250"
MinHeight="200"
UseLayoutRounding="True"
TextOptions.TextFormattingMode="Display"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" d:DesignHeight="500" d:DesignWidth="500"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes"
xmlns:toms="urn:TomsToolbox"
xmlns:viewModels="clr-namespace:ICSharpCode.ILSpy.ViewModels"
d:DataContext="{d:DesignInstance local:MainWindowViewModel}">
<Window x:Class="ICSharpCode.ILSpy.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.ILSpy"
xmlns:avalondock="https://github.com/Dirkster99/AvalonDock"
xmlns:controls="clr-namespace:ICSharpCode.ILSpy.Controls"
xmlns:docking="clr-namespace:ICSharpCode.ILSpy.Docking"
xmlns:properties="clr-namespace:ICSharpCode.ILSpy.Properties"
Title="ILSpy"
MinWidth="250"
MinHeight="200"
UseLayoutRounding="True"
TextOptions.TextFormattingMode="Display"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" d:DesignHeight="500" d:DesignWidth="500"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes"
xmlns:toms="urn:TomsToolbox"
xmlns:viewModels="clr-namespace:ICSharpCode.ILSpy.ViewModels"
d:DataContext="{d:DesignInstance local:MainWindowViewModel}">
<Window.Resources>

<DataTemplate DataType="{x:Type viewModels:TabPageModel}">
Expand Down Expand Up @@ -78,9 +76,12 @@
<MenuItem Header="{x:Static properties:Resources._File}" Tag="_File" />
<!-- contents of file menu are added using MEF -->
<MenuItem Header="{x:Static properties:Resources._View}" Tag="_View">
<MenuItem Header="{x:Static properties:Resources.Show_publiconlyTypesMembers}" IsCheckable="True" IsChecked="{Binding SessionSettings.LanguageSettings.ApiVisPublicOnly}" />
<MenuItem Header="{x:Static properties:Resources.Show_internalTypesMembers}" IsCheckable="True" IsChecked="{Binding SessionSettings.LanguageSettings.ApiVisPublicAndInternal}" />
<MenuItem Header="{x:Static properties:Resources.Show_allTypesAndMembers}" IsCheckable="True" IsChecked="{Binding SessionSettings.LanguageSettings.ApiVisAll}" />
<MenuItem Header="{x:Static properties:Resources.Show_publiconlyTypesMembers}" IsCheckable="True"
IsChecked="{Binding SessionSettings.LanguageSettings.ApiVisPublicOnly}" />
<MenuItem Header="{x:Static properties:Resources.Show_internalTypesMembers}" IsCheckable="True"
IsChecked="{Binding SessionSettings.LanguageSettings.ApiVisPublicAndInternal}" />
<MenuItem Header="{x:Static properties:Resources.Show_allTypesAndMembers}" IsCheckable="True"
IsChecked="{Binding SessionSettings.LanguageSettings.ApiVisAll}" />
<Separator />
<MenuItem Header="{x:Static properties:Resources.Theme}" ItemsSource="{x:Static themes:ThemeManager.AllThemes}">
<MenuItem.ItemContainerStyle>
Expand All @@ -101,9 +102,12 @@
</MenuItem.ItemContainerStyle>
</MenuItem>
<MenuItem Header="{x:Static properties:Resources.UILanguage}">
<MenuItem Header="{x:Static properties:Resources.UILanguage_System}" IsCheckable="True" IsChecked="{Binding SessionSettings.CurrentCulture, Converter={controls:CultureSelectionConverter}, ConverterParameter={x:Null}}" />
<MenuItem Header="English" IsCheckable="True" IsChecked="{Binding SessionSettings.CurrentCulture, Converter={controls:CultureSelectionConverter}, ConverterParameter=en-US}" />
<MenuItem Header="中文" IsCheckable="True" IsChecked="{Binding SessionSettings.CurrentCulture, Converter={controls:CultureSelectionConverter}, ConverterParameter=zh-Hans}" />
<MenuItem Header="{x:Static properties:Resources.UILanguage_System}" IsCheckable="True"
IsChecked="{Binding SessionSettings.CurrentCulture, Converter={controls:CultureSelectionConverter}, ConverterParameter={x:Null}}" />
<MenuItem Header="English" IsCheckable="True"
IsChecked="{Binding SessionSettings.CurrentCulture, Converter={controls:CultureSelectionConverter}, ConverterParameter=en-US}" />
<MenuItem Header="中文" IsCheckable="True"
IsChecked="{Binding SessionSettings.CurrentCulture, Converter={controls:CultureSelectionConverter}, ConverterParameter=zh-Hans}" />
</MenuItem>
</MenuItem>
<MenuItem Header="{x:Static properties:Resources._Window}" Tag="_Window" />
Expand Down
2 changes: 1 addition & 1 deletion ILSpy/Metadata/CorTables/PtrTableTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ struct PtrEntry

public void OnHandleClick()
{
MainWindow.Instance.JumpToReference(new EntityReference(metadataFile, handlePtr.Handle, protocol: "metadata"));
MessageBus.Send(this, new NavigateToReferenceEventArgs(new EntityReference(metadataFile, handlePtr.Handle, protocol: "metadata")));
}

string handleTooltip;
Expand Down
28 changes: 15 additions & 13 deletions ILSpy/Util/MenuService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ public void InitMainMenu(Menu mainMenu)
}
else
{
MenuItem menuItem = new MenuItem();
menuItem.Command = CommandWrapper.Unwrap(entry.Value);
menuItem.Tag = entry.Metadata?.MenuID;
menuItem.Header = ResourceHelper.GetString(entry.Metadata?.Header);
var menuItem = new MenuItem {
Command = CommandWrapper.Unwrap(entry.Value),
Tag = entry.Metadata?.MenuID,
Header = ResourceHelper.GetString(entry.Metadata?.Header)
};
if (!string.IsNullOrEmpty(entry.Metadata?.MenuIcon))
{
menuItem.Icon = new Image {
Expand All @@ -62,7 +63,7 @@ public void InitMainMenu(Menu mainMenu)
}

menuItem.IsEnabled = entry.Metadata?.IsEnabled ?? false;
if (entry.Value is ToggleableCommand toggle)
if (entry.Value is ToggleableCommand)
{
menuItem.IsCheckable = true;
menuItem.SetBinding(MenuItem.IsCheckedProperty, new Binding("IsChecked") { Source = entry.Value, Mode = BindingMode.OneWay });
Expand All @@ -75,7 +76,7 @@ public void InitMainMenu(Menu mainMenu)
}
}

foreach (var (key, item) in parentMenuItems)
foreach (var item in parentMenuItems.Values)
{
if (item.Parent == null)
{
Expand All @@ -90,9 +91,10 @@ MenuItem GetOrAddParentMenuItem(string menuID, string resourceKey)
var topLevelMenuItem = mainMenu.Items.OfType<MenuItem>().FirstOrDefault(m => (string)m.Tag == menuID);
if (topLevelMenuItem == null)
{
parentMenuItem = new MenuItem();
parentMenuItem.Header = ResourceHelper.GetString(resourceKey);
parentMenuItem.Tag = menuID;
parentMenuItem = new() {
Header = ResourceHelper.GetString(resourceKey),
Tag = menuID
};
parentMenuItems.Add(menuID, parentMenuItem);
}
else
Expand Down Expand Up @@ -180,14 +182,14 @@ void ToolsChanged(object sender, NotifyCollectionChangedEventArgs e)

MenuItem CreateMenuItem(ToolPaneModel pane)
{
MenuItem menuItem = new MenuItem();
MenuItem menuItem = new();
menuItem.Command = pane.AssociatedCommand ?? new ToolPaneCommand(pane.ContentId);
menuItem.Header = pane.Title;
menuItem.Tag = pane;
var shortcutKey = pane.ShortcutKey;
if (shortcutKey != null)
{
inputBindings.Add(new InputBinding(menuItem.Command, shortcutKey));
inputBindings.Add(new(menuItem.Command, shortcutKey));
menuItem.InputGestureText = shortcutKey.GetDisplayStringForCulture(CultureInfo.CurrentUICulture);
}
if (!string.IsNullOrEmpty(pane.Icon))
Expand Down Expand Up @@ -262,7 +264,7 @@ void TabsChanged(object sender, NotifyCollectionChangedEventArgs e)

MenuItem CreateMenuItem(TabPageModel pane)
{
MenuItem menuItem = new MenuItem();
MenuItem menuItem = new();
menuItem.Command = new TabPageCommand(pane);
menuItem.Header = pane.Title.Length > 20 ? pane.Title.Substring(20) + "..." : pane.Title;
menuItem.Tag = pane;
Expand Down Expand Up @@ -334,7 +336,7 @@ public void InitToolbar(ToolBar toolBar)

Button MakeToolbarItem(IExport<ICommand, IToolbarCommandMetadata> command)
{
return new Button {
return new() {
Style = ThemeManager.Current.CreateToolBarButtonStyle(),
Command = CommandWrapper.Unwrap(command.Value),
ToolTip = Properties.Resources.ResourceManager.GetString(command.Metadata.ToolTip),
Expand Down

0 comments on commit d7b6ba4

Please sign in to comment.