Browse Source

NodeDescription.xaml and NodeDescriptionViewModel.cs

pull/18/head
PeterForstmeier 14 years ago
parent
commit
e043f3eb5d
  1. 10
      src/AddIns/Analysis/CodeQuality/CodeQuality.csproj
  2. 19
      src/AddIns/Analysis/CodeQuality/Gui/DependencyMatrixView.xaml
  3. 8
      src/AddIns/Analysis/CodeQuality/Gui/DependencyMatrixView.xaml.cs
  4. 29
      src/AddIns/Analysis/CodeQuality/Gui/NodeDescription.xaml
  5. 31
      src/AddIns/Analysis/CodeQuality/Gui/NodeDescription.xaml.cs
  6. 43
      src/AddIns/Analysis/CodeQuality/Gui/NodeDescriptionViewModel.cs

10
src/AddIns/Analysis/CodeQuality/CodeQuality.csproj

@ -67,6 +67,10 @@ @@ -67,6 +67,10 @@
<Compile Include="Engine\ILAnalyzer.cs" />
<Compile Include="Engine\AssemblyAnalyzer.cs" />
<Compile Include="Gui\AnalyzeCodeQualityViewContent.cs" />
<Compile Include="Gui\NodeDescription.xaml.cs">
<DependentUpon>NodeDescription.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Gui\Commands\AnalyzeCodeQualityCommand.cs" />
<Compile Include="Gui\Controls\DependencyMatrix.cs" />
<Compile Include="Gui\Controls\DependencyMatrixControl.cs" />
@ -82,6 +86,7 @@ @@ -82,6 +86,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Gui\MatrixTreeNode.cs" />
<Compile Include="Gui\NodeDescriptionViewModel.cs" />
<Compile Include="Gui\NodeIconService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\DependencyColorizer.cs" />
@ -126,6 +131,10 @@ @@ -126,6 +131,10 @@
<Name>ICSharpCode.Core.Presentation</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Engine\Dom" />
@ -136,6 +145,7 @@ @@ -136,6 +145,7 @@
<Folder Include="Utils" />
</ItemGroup>
<ItemGroup>
<Page Include="Gui\NodeDescription.xaml" />
<Page Include="Gui\DependencyMatrixView.xaml" />
<Page Include="Gui\MainView.xaml" />
</ItemGroup>

19
src/AddIns/Analysis/CodeQuality/Gui/DependencyMatrixView.xaml

@ -14,24 +14,37 @@ @@ -14,24 +14,37 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<gui:NodeDescription x:Name="inform"
Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"></gui:NodeDescription>
<!-- Top TreeView -->
<tv:SharpTreeView Name="topTree" Grid.Column="2" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Hidden" MouseMove="TopTreeMouseMove" ScrollViewer.ScrollChanged="ViewScrollChanged">
<tv:SharpTreeView Name="topTree" Grid.Column="2"
ScrollViewer.HorizontalScrollBarVisibility="Visible"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
MouseMove="TopTreeMouseMove"
ScrollViewer.ScrollChanged="ViewScrollChanged">
<tv:SharpTreeView.LayoutTransform>
<RotateTransform Angle="-90" />
</tv:SharpTreeView.LayoutTransform>
</tv:SharpTreeView>
<!-- -->
<GridSplitter Grid.Column="1"
Grid.RowSpan="3"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
ShowsPreview="True"
Width="1" />
Width="5" />
<!-- -->
<GridSplitter Grid.Row="1"
Grid.ColumnSpan="3"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
ShowsPreview="True"
Height="1" />
Height="5" />
<!-- Left TreeView -->
<tv:SharpTreeView Name="leftTree" Grid.Row="2" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Hidden" MouseMove="LeftTreeMouseMove" ScrollViewer.ScrollChanged="ViewScrollChanged">
</tv:SharpTreeView>

8
src/AddIns/Analysis/CodeQuality/Gui/DependencyMatrixView.xaml.cs

@ -8,10 +8,12 @@ using System.Linq; @@ -8,10 +8,12 @@ using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Windows.Threading;
using ICSharpCode.CodeQuality;
@ -27,11 +29,13 @@ namespace ICSharpCode.CodeQuality.Gui @@ -27,11 +29,13 @@ namespace ICSharpCode.CodeQuality.Gui
public partial class DependencyMatrixView : UserControl
{
ScrollViewer topTreeScrollViewer, leftTreeScrollViewer;
NodeDescriptionViewModel nodeDescriptionViewModel;
public DependencyMatrixView()
{
InitializeComponent();
nodeDescriptionViewModel = new NodeDescriptionViewModel();
this.inform.DataContext = nodeDescriptionViewModel;
topTree.Root = new ICSharpCode.TreeView.SharpTreeNode();
leftTree.Root = new ICSharpCode.TreeView.SharpTreeNode();
matrix.Colorizer = new DependencyColorizer();
@ -126,6 +130,7 @@ namespace ICSharpCode.CodeQuality.Gui @@ -126,6 +130,7 @@ namespace ICSharpCode.CodeQuality.Gui
{
MatrixTreeNode n = ConvertNode(e.OriginalSource as DependencyObject);
if (n != null) {
nodeDescriptionViewModel.Node = n.Node;
matrix.HighlightLine(HeaderType.Rows, n.Node);
leftTree.SelectedItem = n;
}
@ -135,6 +140,7 @@ namespace ICSharpCode.CodeQuality.Gui @@ -135,6 +140,7 @@ namespace ICSharpCode.CodeQuality.Gui
{
MatrixTreeNode n = ConvertNode(e.OriginalSource as DependencyObject);
if (n != null) {
nodeDescriptionViewModel.Node = n.Node;
matrix.HighlightLine(HeaderType.Columns, n.Node);
topTree.SelectedItem = n;
}

29
src/AddIns/Analysis/CodeQuality/Gui/NodeDescription.xaml

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
<UserControl x:Class="ICSharpCode.CodeQuality.Gui.NodeDescription"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Border BorderBrush="Black" CornerRadius="8" BorderThickness="3" >
<Grid>
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="Class" ></TextBlock>
<TextBlock Text="Children" Grid.Row="1"></TextBlock>
<TextBlock Text="Uses" Grid.Row="2"></TextBlock>
<TextBlock Text="Usedby" Grid.Row="3"></TextBlock>
<TextBlock Text="{Binding Node.Name}" Grid.Column="1"></TextBlock>
<TextBlock Text="{Binding Node.Children.Count}" Grid.Column="1" Grid.Row="1" ></TextBlock>
<TextBlock Text="{Binding Uses}" Grid.Column="1" Grid.Row="2"></TextBlock>
<TextBlock Text="{Binding UsedBy}" Grid.Column="1" Grid.Row="3"></TextBlock>
</Grid>
</Grid>
</Border>
</UserControl>

31
src/AddIns/Analysis/CodeQuality/Gui/NodeDescription.xaml.cs

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 26.01.2012
* Time: 20:20
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
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.CodeQuality.Gui
{
/// <summary>
/// Interaction logic for ClassDescription.xaml
/// </summary>
public partial class NodeDescription : UserControl
{
public NodeDescription()
{
InitializeComponent();
}
}
}

43
src/AddIns/Analysis/CodeQuality/Gui/NodeDescriptionViewModel.cs

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Windows.Threading;
using ICSharpCode.CodeQuality;
using ICSharpCode.CodeQuality.Engine.Dom;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Widgets;
using ICSharpCode.TreeView;
namespace ICSharpCode.CodeQuality.Gui
{
public class NodeDescriptionViewModel:ViewModelBase
{
INode node;
public INode Node {
get { return node; }
set { node = value;
base.RaisePropertyChanged(()=>Node);}
}
public int Uses {get {return Node.Uses.Count();}}
public int UsesBy {get {return Node.UsedBy.Count();}}
}
}
Loading…
Cancel
Save