diff --git a/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj b/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
index aa87956230..dfad79b9bb 100644
--- a/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
+++ b/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
@@ -252,6 +252,10 @@
True
False
+
+ {3ED2897F-1A8A-4106-89D2-4D342860D480}
+ TreeMaps
+
@@ -260,6 +264,7 @@
+
-
+
+
+
-
+
-
-
-
+
+
-
-
+
+
-
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
+ VertexClick="graphLayout_VertexClick" />
-
-
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
-
-
+
-
-
- Assembly
- Namespace
- Type
- Field
- Method
+
+
+ Assembly
+ Namespace
+ Type
+ Field
+ Method
-
-
+
+
-
-
+
-
+
-
+
-
-
+
+
@@ -156,51 +215,164 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs b/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs
index d783ff8cb2..a0ac7d4923 100644
--- a/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs
+++ b/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs
@@ -236,6 +236,7 @@ namespace ICSharpCode.CodeQualityAnalysis
cbxMetrics.Items.Add(new ComboBoxItem { Content = "Cyclomatic Complexity" });
cbxMetrics.Items.Add(new ComboBoxItem { Content = "Variables" });
}
+
}
@@ -262,10 +263,10 @@ namespace ICSharpCode.CodeQualityAnalysis
} else if (level == "Field") {
} else if (level == "Method") {
- var r = from ns in MetricsReader.MainModule.Namespaces
- from type in ns.Types
- from method in type.Methods
- select method;
+// var r = from ns in MetricsReader.MainModule.Namespaces
+// from type in ns.Types
+// from method in type.Methods
+// select method;
treemap.ItemsSource = from ns in MetricsReader.MainModule.Namespaces
from type in ns.Types
from method in type.Methods
@@ -281,5 +282,6 @@ namespace ICSharpCode.CodeQualityAnalysis
treemap.ItemDefinition.ValuePath = "Variables";
}
}
+
}
}
diff --git a/src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs b/src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs
index 195df87519..63f0e7c2d9 100644
--- a/src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs
+++ b/src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs
@@ -16,6 +16,7 @@ using System.Windows.Media.Imaging;
using ICSharpCode.CodeQualityAnalysis.Controls;
using ICSharpCode.CodeQualityAnalysis.Utility;
+
using Microsoft.Win32;
namespace ICSharpCode.CodeQualityAnalysis
@@ -23,7 +24,20 @@ namespace ICSharpCode.CodeQualityAnalysis
///
/// Description of MainWindowViewModel.
///
+ public enum MetricsLevel
+ {
+ Assembly,
+ Namespace,
+ Type,
+ Method
+ }
+ public enum Metrics
+ {
+ ILInstructions,
+ CyclomaticComplexity,
+ Variables
+ }
public class MainWindowViewModel :ViewModelBase
{
@@ -38,6 +52,7 @@ namespace ICSharpCode.CodeQualityAnalysis
this.TabDependencyMatrix = "$Dependency Matrix";
this.TabMetrics = "$Metrics";
#endregion
+
MetrixTabEnable = false;
}
@@ -112,8 +127,90 @@ namespace ICSharpCode.CodeQualityAnalysis
public Module MainModule {
get { return mainModule; }
- set { mainModule = value;
- base.RaisePropertyChanged(() =>this.MainModule);}
+ set { mainModule = value;
+ base.RaisePropertyChanged(() =>this.MainModule);
+ }
}
+
+
+ private ObservableCollection nodes;
+
+ public ObservableCollection Nodes {
+ get { return nodes; }
+ set { nodes = value;
+ base.RaisePropertyChanged(() =>this.Nodes);}
+ }
+
+//http://stackoverflow.com/questions/58743/databinding-an-enum-property-to-a-combobox-in-wpf#62032 http://stackoverflow.com/questions/58743/databinding-an-enum-property-to-a-combobox-in-wpf#62032
+
+ //http://www.ageektrapped.com/blog/the-missing-net-7-displaying-enums-in-wpf/
+// http://www.codeproject.com/KB/WPF/FriendlyEnums.aspx
+
+ private string treeValueProperty ;
+
+ public string TreeValueProperty {
+ get { return treeValueProperty; }
+ set { treeValueProperty = value;
+ base.RaisePropertyChanged(() =>this.TreeValueProperty);}
+ }
+
+ // First Combo
+
+ public MetricsLevel MetricsLevel {
+ get {return MetricsLevel;}
+ }
+
+// MetricsLevel metricsLevelSelectedItem = MetricsLevel.Assembly;
+//
+// public MetricsLevel MetricsLevelSelectedItem {
+// get { return metricsLevelSelectedItem; }
+// set { metricsLevelSelectedItem = value;
+// base.RaisePropertyChanged(() =>this.MetricsLevelSelectedItem);
+// }
+// }
+
+ // Second Combo
+
+ public Metrics Metrics
+ {
+ get {return Metrics;}
+ }
+
+ Metrics selectedMetrics;
+
+ public Metrics SelectedMetrics {
+ get { return selectedMetrics; }
+ set { selectedMetrics = value;
+ base.RaisePropertyChanged(() =>this.SelectedMetrics);
+ ActivateTreemap();
+ }
+ }
+
+
+ void ActivateTreemap()
+ {
+ var r = from ns in MainModule.Namespaces
+ from type in ns.Types
+ from method in type.Methods
+ select method;
+ Nodes = new ObservableCollection(r);
+
+ switch (selectedMetrics)
+ {
+ case Metrics.ILInstructions:
+ TreeValueProperty = "Instructions.Count";
+ break;
+
+ case Metrics.CyclomaticComplexity:
+ TreeValueProperty = Metrics.CyclomaticComplexity.ToString();
+ break;
+ case Metrics.Variables:
+ TreeValueProperty = Metrics.Variables.ToString();
+ break;
+ default:
+ throw new Exception("Invalid value for Metrics");
+ }
+ }
+
}
}