You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
448 lines
13 KiB
448 lines
13 KiB
<?xml version="1.0" encoding="utf-8"?> |
|
<Window |
|
x:Class="ICSharpCode.CodeQualityAnalysis.MainWindow" |
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls;assembly=ICSharpCode.WpfDesign.Designer" |
|
xmlns:GraphSharp="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls" |
|
xmlns:Graph="clr-namespace:ICSharpCode.CodeQualityAnalysis.Controls" |
|
xmlns:src="clr-namespace:ICSharpCode.CodeQualityAnalysis" |
|
xmlns:debug="clr-namespace:System.Diagnostics;assembly=System" |
|
xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" |
|
xmlns:tree="http://icsharpcode.net/sharpdevelop/treeview" |
|
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
|
xmlns:t="clr-namespace:TreeMaps.Controls;assembly=TreeMaps" |
|
xmlns:loc ="clr-namespace:ICSharpCode.CodeQualityAnalysis.Utility.Localizeable" |
|
xmlns:util="clr-namespace:ICSharpCode.CodeQualityAnalysis.Utility" |
|
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
|
Title="{Binding FrmTitle}" |
|
x:Name="root"> |
|
|
|
<Window.DataContext> |
|
<src:MainWindowViewModel /> |
|
</Window.DataContext> |
|
|
|
<Window.Resources> |
|
<ResourceDictionary> |
|
<ResourceDictionary.MergedDictionaries> |
|
<ResourceDictionary |
|
Source="../Resources/GraphTemplate.xaml" /> |
|
<ResourceDictionary |
|
Source="../Resources/GridSplitterTemplate.xaml" /> |
|
</ResourceDictionary.MergedDictionaries> |
|
</ResourceDictionary> |
|
</Window.Resources> |
|
|
|
<Grid> |
|
<Grid.RowDefinitions> |
|
<RowDefinition |
|
Height="Auto" /> |
|
<RowDefinition /> |
|
<RowDefinition |
|
Height="Auto" /> |
|
</Grid.RowDefinitions> |
|
<!-- |
|
<ToolBarTray |
|
Background="White" |
|
Grid.Row="0"> |
|
<ToolBar> |
|
<Button |
|
Name="btnOpenAssembly" |
|
Content="{Binding btnOpenAssembly}" |
|
Click="btnOpenAssembly_Click" |
|
Margin="0 0 5 0"></Button> |
|
</ToolBar> |
|
</ToolBarTray>--> |
|
<Menu> |
|
<MenuItem Header="File"> |
|
<MenuItem Header="{Binding btnOpenAssembly}" |
|
Click="btnOpenAssembly_Click"> |
|
</MenuItem> |
|
<MenuItem Header="{core:Localize Global.CloseButtonText}" Click="MenuClose_Click"> |
|
</MenuItem> |
|
</MenuItem> |
|
|
|
</Menu> |
|
<TabControl |
|
Grid.Row="1" |
|
IsEnabled="{Binding MainTabEnable}" |
|
SelectedItem="{Binding SelectedTabItem}"> |
|
<!-- It is enabled once assembly is loaded. --> |
|
<TabItem |
|
Header="{Binding TabDependencyGraph}"> |
|
<Grid> |
|
<Grid.RowDefinitions> |
|
<RowDefinition |
|
Height="Auto" /> |
|
<RowDefinition /> |
|
</Grid.RowDefinitions> |
|
<Grid.ColumnDefinitions> |
|
<ColumnDefinition |
|
Width="250px" /> |
|
<ColumnDefinition |
|
Width="Auto"></ColumnDefinition> |
|
<ColumnDefinition /> |
|
<ColumnDefinition |
|
Width="Auto"></ColumnDefinition> |
|
<ColumnDefinition |
|
Width="200px" /> |
|
</Grid.ColumnDefinitions> |
|
<ToolBarTray |
|
Grid.Row="0" |
|
Grid.ColumnSpan="5"> |
|
<ToolBar> |
|
<Button |
|
Name="btnRelayout" |
|
Click="btnRelayout_Click" |
|
Margin="0 0 5 0">Relayout</Button> |
|
<Button |
|
Name="btnContinueLayout" |
|
Click="btnContinueLayout_Click" |
|
Margin="0 0 5 0">Continue Layout</Button> |
|
<Button |
|
Name="btnResetGraph" |
|
Click="btnResetGraph_Click" |
|
Margin="0 0 5 0">Reset Graph</Button> |
|
<Button |
|
Name="btnSaveImageGraph" |
|
Click="btnSaveImageGraph_Click">Save an Image of Graph</Button> |
|
</ToolBar> |
|
</ToolBarTray> |
|
<tree:SharpTreeView |
|
Name="definitionTree" |
|
Grid.Row="1" |
|
Grid.Column="0" |
|
Margin="2" |
|
SelectionChanged="definitionTree_SelectedItemChanged"></tree:SharpTreeView> |
|
<GridSplitter |
|
Grid.Column="1" |
|
Grid.Row="1" |
|
Grid.RowSpan="2" |
|
ResizeDirection="Columns" |
|
HorizontalAlignment="Stretch" |
|
VerticalAlignment="Stretch" |
|
Style="{DynamicResource GridSplitterStyle1}"></GridSplitter> |
|
<Controls:ZoomControl |
|
Grid.Row="1" |
|
Grid.Column="2" |
|
Name="zoom" |
|
AlwaysShowZoomButtons="True" |
|
HorizontalScrollBarVisibility="Visible" |
|
VerticalScrollBarVisibility="Visible"> |
|
<Graph:DependencyGraphLayout |
|
x:Name="graphLayout" |
|
LayoutAlgorithmType="LinLog" |
|
OverlapRemovalAlgorithmType="FSA" |
|
HighlightAlgorithmType="Simple" |
|
VertexClick="graphLayout_VertexClick" /> |
|
</Controls:ZoomControl> |
|
<GridSplitter |
|
Grid.Column="3" |
|
Grid.Row="2" |
|
ResizeDirection="Columns" |
|
ResizeBehavior="PreviousAndNext" |
|
Style="{DynamicResource GridSplitterStyle1}"></GridSplitter> |
|
<TextBlock |
|
Name="txbTypeInfo" |
|
Text="{Binding TypeInfo}" |
|
Margin="2" |
|
MinWidth="30" |
|
Grid.Column="4" |
|
Grid.Row="1" |
|
Padding="5" |
|
Background="LightBlue" /> |
|
</Grid> |
|
</TabItem> |
|
|
|
<TabItem |
|
Header="{Binding TabDependencyMatrix}"> |
|
<Graph:TreeMatrixControl |
|
x:Name="matrixControl"></Graph:TreeMatrixControl> |
|
</TabItem> |
|
|
|
<!-- Initial version of Thomaz |
|
<TabItem |
|
Header="{Binding TabMetrics}" |
|
IsEnabled="{Binding MetrixTabEnable}"> |
|
<Grid> |
|
<Grid.RowDefinitions> |
|
<RowDefinition |
|
Height="Auto" /> |
|
<RowDefinition |
|
Height="*" /> |
|
</Grid.RowDefinitions> |
|
<Grid.ColumnDefinitions> |
|
<ColumnDefinition |
|
Width="*" /> |
|
</Grid.ColumnDefinitions> |
|
<ToolBarTray |
|
Background="White" |
|
Grid.Row="0" |
|
Grid.Column="0"> |
|
<ToolBar> |
|
<TextBlock |
|
Text="Level: " /> |
|
<ComboBox |
|
IsEditable="False" |
|
x:Name="cbxMetrixLevel" |
|
IsDropDownOpen="True" |
|
Width="150" |
|
SelectionChanged="MetricLevel_SelectionChanged"> |
|
<ComboBoxItem |
|
Name="assembly">Assembly</ComboBoxItem> |
|
<ComboBoxItem |
|
Name="namespace">Namespace</ComboBoxItem> |
|
<ComboBoxItem |
|
Name="type">Type</ComboBoxItem> |
|
<ComboBoxItem |
|
Name="field">Field</ComboBoxItem> |
|
<ComboBoxItem |
|
Name="method">Method</ComboBoxItem> |
|
</ComboBox> |
|
<TextBlock |
|
Text="Metric: " /> |
|
<ComboBox |
|
Width="200" |
|
x:Name="cbxMetrics" |
|
SelectionChanged="Metrics_SelectionChanged" /> |
|
</ToolBar> |
|
</ToolBarTray> |
|
<datavis:TreeMap |
|
x:Name="treemap" |
|
Grid.Row="1" |
|
Grid.Column="0"> |
|
<datavis:TreeMap.ItemDefinition> |
|
<datavis:TreeMapItemDefinition |
|
ValuePath="Instructions.Count"> |
|
<DataTemplate> |
|
<Border |
|
Background="AliceBlue" |
|
BorderBrush="Black" |
|
BorderThickness="1" |
|
ToolTipService.ToolTip="{Binding ToolTip}"> |
|
<StackPanel> |
|
<TextBlock |
|
Text="{Binding DeclaringType.Name}" /> |
|
<TextBlock |
|
Text="{Binding Name}" |
|
VerticalAlignment="Center" |
|
TextAlignment="Center" |
|
TextWrapping="Wrap" /> |
|
</StackPanel> |
|
</Border> |
|
</DataTemplate> |
|
</datavis:TreeMapItemDefinition> |
|
</datavis:TreeMap.ItemDefinition> |
|
</datavis:TreeMap> |
|
</Grid> |
|
</TabItem> |
|
--> |
|
|
|
<TabItem |
|
Name="TreeMapTabItem" |
|
Header="{Binding TabMetrics}" |
|
IsEnabled="{Binding MetrixTabEnable}"> |
|
<TabItem.Resources> |
|
|
|
<ObjectDataProvider MethodName="GetValues" |
|
ObjectType="{x:Type sys:Enum}" |
|
x:Key="MetricsLevel"> |
|
<ObjectDataProvider.MethodParameters> |
|
<x:Type TypeName="src:MetricsLevel" /> |
|
</ObjectDataProvider.MethodParameters> |
|
</ObjectDataProvider> |
|
|
|
<!-- |
|
<ObjectDataProvider MethodName="GetValues" |
|
ObjectType="{x:Type sys:Enum}" |
|
x:Key="Metrics"> |
|
<ObjectDataProvider.MethodParameters> |
|
<x:Type TypeName="src:Metrics" /> |
|
</ObjectDataProvider.MethodParameters> |
|
</ObjectDataProvider> |
|
--> |
|
<loc:EnumToFriendlyNameConverter x:Key="enumItemsConverter"/> |
|
|
|
<DataTemplate |
|
x:Key="TreeMapDataTemplate"> |
|
<Border |
|
Background="AliceBlue" |
|
BorderBrush="Black" |
|
BorderThickness="1"> |
|
<StackPanel> |
|
<TextBlock |
|
Text="{Binding DeclaringType.Name}" /> |
|
<TextBlock |
|
Text="{Binding Name}" |
|
VerticalAlignment="Center" |
|
TextAlignment="Center" |
|
TextWrapping="Wrap" /> |
|
</StackPanel> |
|
</Border> |
|
</DataTemplate> |
|
</TabItem.Resources> |
|
<Grid> |
|
<Grid.RowDefinitions> |
|
<RowDefinition |
|
Height="Auto" /> |
|
<RowDefinition |
|
Height="*" /> |
|
</Grid.RowDefinitions> |
|
<Grid.ColumnDefinitions> |
|
<ColumnDefinition |
|
Width="*" /> |
|
</Grid.ColumnDefinitions> |
|
|
|
<ToolBarTray |
|
Background="White" |
|
Grid.Row="0" |
|
Grid.Column="0"> |
|
<ToolBar> |
|
<TextBlock Text="Level: " /> |
|
|
|
<util:ComboBoxWithCommand Width="200" |
|
ItemsSource="{Binding Source={StaticResource MetricsLevel}}" |
|
SelectedItem="{Binding SelectedMetricsLevel}" |
|
Command="{Binding ActivateMetrics}"> |
|
</util:ComboBoxWithCommand> |
|
|
|
<TextBlock Margin="4,0,0,0" Text="Metric: " /> |
|
<!-- |
|
<util:ComboBoxWithCommand Width="200" Margin="4,0,0,0" |
|
ItemsSource="{Binding Source={StaticResource Metrics}}" |
|
SelectedItem="{Binding SelectedMetrics}" |
|
SelectedIndex="{Binding SelectedMetricsIndex}" |
|
Command="{Binding ShowTreeMap}"> |
|
|
|
<util:ComboBoxWithCommand.ItemTemplate> |
|
<DataTemplate> |
|
<Label Content="{Binding Path=.,Mode=OneWay, |
|
Converter={StaticResource enumItemsConverter}}" |
|
Height="Auto" |
|
Margin="0" |
|
VerticalAlignment="Center"/> |
|
|
|
</DataTemplate> |
|
</util:ComboBoxWithCommand.ItemTemplate> |
|
</util:ComboBoxWithCommand> |
|
--> |
|
<util:ComboBoxWithCommand Width="200" Margin="4,0,0,0" |
|
ItemsSource="{Binding ItemsWithCommand}" |
|
SelectedItem="{Binding SelectedItemWithCommand}" |
|
Command="{Binding ExecuteSelectedItemWithCommand}"> |
|
<util:ComboBoxWithCommand.ItemTemplate> |
|
<DataTemplate> |
|
<Label Content="{Binding Description}"></Label> |
|
</DataTemplate> |
|
</util:ComboBoxWithCommand.ItemTemplate> |
|
</util:ComboBoxWithCommand> |
|
</ToolBar> |
|
</ToolBarTray> |
|
|
|
<!-- http://treemaps.codeplex.com/--> |
|
|
|
<t:TreeMaps |
|
Grid.Row="1" |
|
Grid.Column="0" |
|
Loaded="TreeMaps_Loaded" |
|
ItemsSource="{Binding Nodes}" |
|
Background="LightGray" |
|
TreeMapMode="Squarified" |
|
ItemTemplate="{StaticResource TreeMapDataTemplate}" |
|
ValuePropertyName="{Binding TreeValueProperty}"> |
|
</t:TreeMaps> |
|
</Grid> |
|
</TabItem> |
|
</TabControl> |
|
|
|
<StatusBar |
|
Grid.Row="2"> |
|
<StatusBarItem |
|
HorizontalAlignment="Left" |
|
Visibility="{Binding ProgressbarVisible}"> |
|
<StackPanel |
|
Orientation="Horizontal"> |
|
<TextBlock |
|
Text="Loading " /> |
|
<TextBlock |
|
Text="{Binding FileName}"></TextBlock> |
|
<TextBlock |
|
Text="..." |
|
Margin="0, 0, 5, 0" /> |
|
<ProgressBar |
|
IsIndeterminate="True" |
|
Width="95" |
|
Height="15" /> |
|
</StackPanel> |
|
</StatusBarItem> |
|
<!-- |
|
<StatusBarItem |
|
HorizontalAlignment="Right" |
|
Visibility="{Binding AssemblyStatsVisible}"> |
|
<StackPanel |
|
Orientation="Horizontal"> |
|
<StatusBarItem> |
|
<StackPanel |
|
Orientation="Horizontal"> |
|
<TextBlock |
|
Text="Namespaces: " /> |
|
<TextBlock |
|
Text="{Binding Path=MainModule.Namespaces.Count}" /> |
|
</StackPanel> |
|
</StatusBarItem> |
|
<StatusBarItem> |
|
<StackPanel |
|
Orientation="Horizontal"> |
|
<TextBlock |
|
Text="Types: " /> |
|
<TextBlock |
|
Text="{Binding Path=MainModule.TypesCount}" /> |
|
</StackPanel> |
|
</StatusBarItem> |
|
<StatusBarItem> |
|
<StackPanel |
|
Orientation="Horizontal"> |
|
<TextBlock |
|
Text="Methods: " /> |
|
<TextBlock |
|
Text="{Binding Path=MainModule.MethodsCount}" /> |
|
</StackPanel> |
|
</StatusBarItem> |
|
<StatusBarItem> |
|
<StackPanel |
|
Orientation="Horizontal"> |
|
<TextBlock |
|
Text="Fields: " /> |
|
<TextBlock |
|
Text="{Binding Path=MainModule.FieldsCount}" /> |
|
</StackPanel> |
|
</StatusBarItem> |
|
<StatusBarItem> |
|
<StackPanel |
|
Orientation="Horizontal"> |
|
<TextBlock |
|
Text="IL instructions: " /> |
|
<TextBlock |
|
Text="{Binding Path=MainModule.InstructionsCount}" /> |
|
</StackPanel> |
|
</StatusBarItem> |
|
</StackPanel> |
|
</StatusBarItem> |
|
--> |
|
<StatusBarItem |
|
HorizontalAlignment="Right" |
|
Visibility="{Binding AssemblyStatsVisible}"> |
|
<StatusBarItem> |
|
<StackPanel |
|
Orientation="Horizontal"> |
|
<TextBlock |
|
Text="Summary: " /> |
|
<TextBlock |
|
Text="{Binding Summary}" /> |
|
</StackPanel> |
|
</StatusBarItem> |
|
</StatusBarItem> |
|
</StatusBar> |
|
|
|
</Grid> |
|
</Window> |