diff --git a/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj b/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj index a4b5d72635..aa87956230 100644 --- a/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj +++ b/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj @@ -133,7 +133,7 @@ - + diff --git a/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml b/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml index fdb3f9a28c..055936704b 100644 --- a/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml +++ b/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml @@ -1,6 +1,7 @@  - - - - - + + + + + - + @@ -106,14 +104,14 @@ DataContext="{Binding RelativeSource={RelativeSource Self}}" Text="{Binding TypeInfo}" Margin="2" MinWidth="30" Grid.Column="4" Grid.Row="1" - Padding="5" + Padding="5" Background="LightBlue"/> - + @@ -127,7 +125,10 @@ DataContext="{Binding RelativeSource={RelativeSource Self}}" - + Assembly Namespace Type @@ -156,6 +157,7 @@ DataContext="{Binding RelativeSource={RelativeSource Self}}" + diff --git a/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs b/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs index 23c09fc837..d783ff8cb2 100644 --- a/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs +++ b/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs @@ -58,7 +58,7 @@ namespace ICSharpCode.CodeQualityAnalysis private void btnOpenAssembly_Click(object sender, RoutedEventArgs e) { - var dataContext = this.DataContext as MainWindowTranslationViewModel; + var dataContext = this.DataContext as MainWindowViewModel; var fileDialog = new OpenFileDialog { @@ -137,6 +137,8 @@ namespace ICSharpCode.CodeQualityAnalysis definitionTree.SelectedItem = item; var graph = item.INode.Dependency.BuildDependencyGraph(); graphLayout.ChangeGraph(graph); + var d = this.DataContext as MainWindowViewModel; + d.MetrixTabEnable = true; } } @@ -149,7 +151,7 @@ namespace ICSharpCode.CodeQualityAnalysis var vertex = vertexControl.Vertex as DependencyVertex; if (vertex != null) { - var d = this.DataContext as MainWindowTranslationViewModel; + var d = this.DataContext as MainWindowViewModel; d.TypeInfo = vertex.Node.GetInfo(); } } @@ -260,6 +262,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; treemap.ItemsSource = from ns in MetricsReader.MainModule.Namespaces from type in ns.Types from method in type.Methods diff --git a/src/AddIns/Analysis/CodeQuality/Src/MainWindowTranslationModel.cs b/src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs similarity index 55% rename from src/AddIns/Analysis/CodeQuality/Src/MainWindowTranslationModel.cs rename to src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs index 1bf690c5c5..195df87519 100644 --- a/src/AddIns/Analysis/CodeQuality/Src/MainWindowTranslationModel.cs +++ b/src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs @@ -7,6 +7,7 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Windows; @@ -22,30 +23,35 @@ namespace ICSharpCode.CodeQualityAnalysis /// /// Description of MainWindowViewModel. /// - public class MainWindowTranslationViewModel :ViewModelBase + + + public class MainWindowViewModel :ViewModelBase { - public MainWindowTranslationViewModel():base() + public MainWindowViewModel():base() { this.FrmTitle = "$Code Quality Analysis"; this.btnOpenAssembly = "$Open Assembly"; + #region MainTab this.TabDependencyGraph = "$Dependency Graph"; this.TabDependencyMatrix = "$Dependency Matrix"; this.TabMetrics = "$Metrics"; #endregion - - + MetrixTabEnable = false; } public string FrmTitle {get;private set;} public string btnOpenAssembly {get; private set;} + #region Main TabControl + public string TabDependencyGraph {get; private set;} public string TabDependencyMatrix {get; private set;} public string TabMetrics {get;private set;} + #endregion @@ -57,6 +63,7 @@ namespace ICSharpCode.CodeQualityAnalysis base.RaisePropertyChanged(() =>FileName);} } + private Visibility progressbarVisibly = Visibility.Hidden; public Visibility ProgressbarVisible { @@ -84,6 +91,13 @@ namespace ICSharpCode.CodeQualityAnalysis } } + bool metrixTabEnable; + + public bool MetrixTabEnable { + get { return metrixTabEnable; } + set { metrixTabEnable = value; + base.RaisePropertyChanged(() => MetrixTabEnable);} + } string typeInfo; @@ -99,76 +113,7 @@ namespace ICSharpCode.CodeQualityAnalysis public Module MainModule { get { return mainModule; } set { mainModule = value; - base.RaisePropertyChanged(() =>this.MainModule);} - - + base.RaisePropertyChanged(() =>this.MainModule);} } - - /* - #region OpenAssembly - - public ICommand OpenAssemblyCommand - { - get { return new RelayCommand(SaveAssemblyExecute, CanSaveAssemblyExecute); } - } - - Boolean CanSaveAssemblyExecute() - { - return true; - } - - - void SaveAssemblyExecute() - { - var fileDialog = new SaveFileDialog() - { - Filter = "PNG (*.png)|*.png|JPEG (*.jpg)|*.jpg|GIF (*.gif)|*.gif|BMP (*.bmp)|*.bmp|TIFF (.tiff)|*.tiff" - }; - - fileDialog.ShowDialog(); - - if (String.IsNullOrEmpty(fileDialog.FileName)) - return; - - // render it - var renderBitmap = new RenderTargetBitmap((int)graphLayout.ActualWidth, - (int)graphLayout.ActualHeight, - 96d, - 96d, - PixelFormats.Default); - renderBitmap.Render(graphLayout); - - using (var outStream = new FileStream(fileDialog.FileName, FileMode.Create)) - { - BitmapEncoder encoder; - - switch (fileDialog.FilterIndex) - { - case 1: - encoder = new PngBitmapEncoder(); - break; - case 2: - encoder = new JpegBitmapEncoder(); - break; - case 3: - encoder = new GifBitmapEncoder(); - break; - case 4: - encoder = new BmpBitmapEncoder(); - break; - case 5: - encoder = new TiffBitmapEncoder(); - break; - default: - encoder = new PngBitmapEncoder(); - break; - } - - encoder.Frames.Add(BitmapFrame.Create(renderBitmap)); - encoder.Save(outStream); - } - } - #endregion - */ } }