Browse Source

Add AboutDialog.

pull/1/head
Daniel Grunwald 14 years ago
parent
commit
2b29fb2912
  1. 23
      ILSpy/AboutDialog.xaml
  2. 30
      ILSpy/AboutDialog.xaml.cs
  3. 8
      ILSpy/App.xaml
  4. 19
      ILSpy/App.xaml.cs
  5. 5
      ILSpy/ILSpy.csproj
  6. 135
      ILSpy/MainWindow.xaml
  7. 11
      ILSpy/MainWindow.xaml.cs
  8. 2
      ILSpy/Properties/AssemblyInfo.cs

23
ILSpy/AboutDialog.xaml

@ -0,0 +1,23 @@
<Window x:Class="ICSharpCode.ILSpy.AboutDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.ILSpy"
Title="About ILSpy"
Style="{DynamicResource DialogWindow}"
ResizeMode="NoResize"
WindowStartupLocation="CenterOwner"
SizeToContent="WidthAndHeight">
<StackPanel Margin="8">
<TextBlock TextWrapping="WrapWithOverflow" FontSize="12">
ILSpy version <Run Text="{x:Static local:AboutDialog.Version}"/>.<LineBreak/>
Copyright 2011 by AlphaSierraPapa for the SharpDevelop Team.<LineBreak/>
Website: <Hyperlink NavigateUri="http://www.ilspy.net/">http://www.ilspy.net/</Hyperlink><LineBreak/>
<LineBreak/>
This software makes use of the following open-source projects:<LineBreak/>
<Hyperlink NavigateUri="http://www.mono-project.com/Cecil">Mono.Cecil</Hyperlink> (reading IL)<LineBreak/>
<Hyperlink NavigateUri="http://www.avalonedit.net/">ICSharpCode.AvalonEdit</Hyperlink><LineBreak/>
<Hyperlink NavigateUri="http://www.sharpdevelop.net/">SharpDevelop</Hyperlink> components (SharpTreeView, NRefactory)<LineBreak/>
</TextBlock>
<Button IsCancel="True" MinWidth="73" HorizontalAlignment="Center">Close</Button>
</StackPanel>
</Window>

30
ILSpy/AboutDialog.xaml.cs

@ -0,0 +1,30 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
namespace ICSharpCode.ILSpy
{
/// <summary>
/// Interaction logic for AboutDialog.xaml
/// </summary>
public partial class AboutDialog : Window
{
public AboutDialog()
{
InitializeComponent();
}
public static string Version {
get { return typeof(AboutDialog).Assembly.GetName().Version.ToString(); }
}
}
}

8
ILSpy/App.xaml

@ -1,9 +1,9 @@
<Application x:Class="ICSharpCode.ILSpy.App" <Application x:Class="ICSharpCode.ILSpy.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml">
<Application.Resources> <Application.Resources>
<Style x:Key="DialogWindow" TargetType="{x:Type Window}"> <Style x:Key="DialogWindow" TargetType="{x:Type Window}">
<Setter Property="ShowInTaskbar" Value="False"/> <Setter Property="ShowInTaskbar" Value="False"/>
<Setter Property="UseLayoutRounding" Value="True"/> <Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/> <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>

19
ILSpy/App.xaml.cs

@ -1,8 +1,8 @@
using System; using System;
using System.Diagnostics;
using System.Windows; using System.Windows;
using System.Data; using System.Windows.Documents;
using System.Xml; using System.Windows.Navigation;
using System.Configuration;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
@ -11,5 +11,18 @@ namespace ICSharpCode.ILSpy
/// </summary> /// </summary>
public partial class App : Application public partial class App : Application
{ {
public App()
{
InitializeComponent();
EventManager.RegisterClassHandler(typeof(Window),
Hyperlink.RequestNavigateEvent,
new RequestNavigateEventHandler(Window_RequestNavigate));
}
void Window_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
Process.Start(e.Uri.ToString());
}
} }
} }

5
ILSpy/ILSpy.csproj

@ -60,6 +60,10 @@
<ApplicationDefinition Include="App.xaml" /> <ApplicationDefinition Include="App.xaml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AboutDialog.xaml.cs">
<DependentUpon>AboutDialog.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="App.xaml.cs"> <Compile Include="App.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
@ -84,6 +88,7 @@
<Compile Include="TypeTreeNode.cs" /> <Compile Include="TypeTreeNode.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Page Include="AboutDialog.xaml" />
<Page Include="MainWindow.xaml" /> <Page Include="MainWindow.xaml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

135
ILSpy/MainWindow.xaml

@ -7,48 +7,99 @@
MinWidth="250" MinWidth="250"
MinHeight="200" MinHeight="200"
UseLayoutRounding="True" UseLayoutRounding="True"
Hyperlink.RequestNavigate="Window_RequestNavigate"
TextOptions.TextFormattingMode="Display" TextOptions.TextFormattingMode="Display"
> >
<!-- Main grid separating left pane (treeView) from main pane (textEditor) --> <DockPanel>
<Grid> <Menu
<Grid.ColumnDefinitions> DockPanel.Dock="Top">
<ColumnDefinition <MenuItem
MinWidth="100" Header="_File">
Width="250" /> <MenuItem
<ColumnDefinition Command="Open">
Width="3" /> <MenuItem.Icon>
<ColumnDefinition <Image
MinWidth="100" Width="16"
Width="0.514411764705882*" /> Height="16"
</Grid.ColumnDefinitions> Source="Images/Open.png" />
<Grid.RowDefinitions> </MenuItem.Icon>
<RowDefinition </MenuItem>
Height="*" /> <Separator />
</Grid.RowDefinitions> <MenuItem
<!-- Tree View of assemblies and classes --> Header="E_xit"
<tv:SharpTreeView Click="ExitClick" />
Name="treeView" </MenuItem>
ShowRoot="False" <MenuItem
AllowDropOrder="True" Header="_Help">
AllowDrop="True" /> <MenuItem
<GridSplitter Header="_About"
Grid.ZIndex="1" Click="AboutClick" />
Grid.Column="1" </MenuItem>
Margin="-2,0" </Menu>
BorderThickness="2,0" <ToolBar
BorderBrush="Transparent" DockPanel.Dock="Top">
HorizontalAlignment="Stretch" /> <ToolBar.Resources>
<!-- DockPanel in right pane --> <!-- Make images transparent if menu command is disabled -->
<DockPanel <Style
Grid.Column="2"> TargetType="{x:Type Image}">
<ae:TextEditor <Style.Triggers>
SyntaxHighlighting="C#" <DataTrigger
FontFamily="Consolas" Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type ButtonBase}, AncestorLevel=1}, Path=IsEnabled}"
FontSize="10pt" Value="False">
IsReadOnly="True" <Setter
Background="{DynamicResource {x:Static SystemColors.InfoBrushKey}}" Property="Opacity"
Foreground="{DynamicResource {x:Static SystemColors.InfoTextBrushKey}}" /> Value="0.30" />
</DockPanel> </DataTrigger>
</Grid> </Style.Triggers>
</Style>
</ToolBar.Resources>
<Button
Command="Open">
<Image
Width="16"
Height="16"
Source="Images/Open.png" />
</Button>
</ToolBar>
<!-- Main grid separating left pane (treeView) from main pane (textEditor) -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
MinWidth="100"
Width="250" />
<ColumnDefinition
Width="3" />
<ColumnDefinition
MinWidth="100"
Width="0.514411764705882*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition
Height="*" />
</Grid.RowDefinitions>
<!-- Tree View of assemblies and classes -->
<tv:SharpTreeView
Name="treeView"
ShowRoot="False"
AllowDropOrder="True"
AllowDrop="True" />
<GridSplitter
Grid.ZIndex="1"
Grid.Column="1"
Margin="-2,0"
BorderThickness="2,0"
BorderBrush="Transparent"
HorizontalAlignment="Stretch" />
<!-- DockPanel in right pane -->
<DockPanel
Grid.Column="2">
<ae:TextEditor
SyntaxHighlighting="C#"
FontFamily="Consolas"
FontSize="10pt"
IsReadOnly="True"
Background="{DynamicResource {x:Static SystemColors.InfoBrushKey}}"
Foreground="{DynamicResource {x:Static SystemColors.InfoTextBrushKey}}" />
</DockPanel>
</Grid>
</DockPanel>
</Window> </Window>

11
ILSpy/MainWindow.xaml.cs

@ -42,9 +42,16 @@ namespace ICSharpCode.ILSpy
assemblies.Add(new AssemblyTreeNode(asm.Location)); assemblies.Add(new AssemblyTreeNode(asm.Location));
} }
void Window_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e) void ExitClick(object sender, RoutedEventArgs e)
{ {
Process.Start(e.Uri.ToString()); Close();
}
void AboutClick(object sender, RoutedEventArgs e)
{
AboutDialog dlg = new AboutDialog();
dlg.Owner = this;
dlg.ShowDialog();
} }
} }
} }

2
ILSpy/Properties/AssemblyInfo.cs

@ -28,4 +28,4 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can use the default the Revision and // You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below: // Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.*")]

Loading…
Cancel
Save