Browse Source

Extend CodeQuality/Src/MainWindowModel.cs with Menu

pull/787/head
PeterForstmeier 14 years ago
parent
commit
02cb93910b
  1. 21
      src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml
  2. 18
      src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs
  3. 12
      src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs

21
src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml

@ -14,6 +14,7 @@
xmlns:t="clr-namespace:TreeMaps.Controls;assembly=TreeMaps" xmlns:t="clr-namespace:TreeMaps.Controls;assembly=TreeMaps"
xmlns:loc ="clr-namespace:ICSharpCode.CodeQualityAnalysis.Utility.Localizeable" xmlns:loc ="clr-namespace:ICSharpCode.CodeQualityAnalysis.Utility.Localizeable"
xmlns:util="clr-namespace:ICSharpCode.CodeQualityAnalysis.Utility" xmlns:util="clr-namespace:ICSharpCode.CodeQualityAnalysis.Utility"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
Title="{Binding FrmTitle}" Title="{Binding FrmTitle}"
x:Name="root"> x:Name="root">
@ -40,6 +41,7 @@
<RowDefinition <RowDefinition
Height="Auto" /> Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--
<ToolBarTray <ToolBarTray
Background="White" Background="White"
Grid.Row="0"> Grid.Row="0">
@ -50,7 +52,17 @@
Click="btnOpenAssembly_Click" Click="btnOpenAssembly_Click"
Margin="0 0 5 0"></Button> Margin="0 0 5 0"></Button>
</ToolBar> </ToolBar>
</ToolBarTray> </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 <TabControl
Grid.Row="1" Grid.Row="1"
IsEnabled="{Binding MainTabEnable}"> IsEnabled="{Binding MainTabEnable}">
@ -147,6 +159,7 @@
x:Name="matrixControl"></Graph:TreeMatrixControl> x:Name="matrixControl"></Graph:TreeMatrixControl>
</TabItem> </TabItem>
<!-- Initial version of Thomaz
<TabItem <TabItem
Header="{Binding TabMetrics}" Header="{Binding TabMetrics}"
IsEnabled="{Binding MetrixTabEnable}"> IsEnabled="{Binding MetrixTabEnable}">
@ -222,7 +235,8 @@
</datavis:TreeMap> </datavis:TreeMap>
</Grid> </Grid>
</TabItem> </TabItem>
-->
<TabItem <TabItem
Header="{Binding TabMetrics}" Header="{Binding TabMetrics}"
IsEnabled="{Binding MetrixTabEnable}"> IsEnabled="{Binding MetrixTabEnable}">
@ -293,9 +307,8 @@
<util:ComboBoxWithCommand Width="200" Margin="4,0,0,0" <util:ComboBoxWithCommand Width="200" Margin="4,0,0,0"
ItemsSource="{Binding Source={StaticResource Metrics}}" ItemsSource="{Binding Source={StaticResource Metrics}}"
SelectedItem="{Binding SelectedMetrics}"
Command="{Binding ShowTreeMap}"> Command="{Binding ShowTreeMap}">
<util:ComboBoxWithCommand.ItemTemplate> <util:ComboBoxWithCommand.ItemTemplate>
<DataTemplate> <DataTemplate>
<Label Content="{Binding Path=.,Mode=OneWay, <Label Content="{Binding Path=.,Mode=OneWay,

18
src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs

@ -2,10 +2,8 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
@ -58,9 +56,6 @@ namespace ICSharpCode.CodeQualityAnalysis
private void btnOpenAssembly_Click(object sender, RoutedEventArgs e) private void btnOpenAssembly_Click(object sender, RoutedEventArgs e)
{ {
var dataContext = this.DataContext as MainWindowViewModel;
var fileDialog = new OpenFileDialog var fileDialog = new OpenFileDialog
{ {
Filter = "Component Files (*.dll, *.exe)|*.dll;*.exe" Filter = "Component Files (*.dll, *.exe)|*.dll;*.exe"
@ -71,6 +66,7 @@ namespace ICSharpCode.CodeQualityAnalysis
if (String.IsNullOrEmpty(fileDialog.FileName)) if (String.IsNullOrEmpty(fileDialog.FileName))
return; return;
var dataContext = this.DataContext as MainWindowViewModel;
dataContext.ProgressbarVisible = Visibility.Visible; dataContext.ProgressbarVisible = Visibility.Visible;
dataContext.AssemblyStatsVisible = Visibility.Hidden; dataContext.AssemblyStatsVisible = Visibility.Hidden;
dataContext.FileName = System.IO.Path.GetFileName(fileDialog.FileName); dataContext.FileName = System.IO.Path.GetFileName(fileDialog.FileName);
@ -214,7 +210,7 @@ namespace ICSharpCode.CodeQualityAnalysis
encoder.Save(outStream); encoder.Save(outStream);
} }
} }
/*
private void MetricLevel_SelectionChanged(object sender, SelectionChangedEventArgs e) private void MetricLevel_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
var comboBoxItem = cbxMetrixLevel.SelectedItem as ComboBoxItem; var comboBoxItem = cbxMetrixLevel.SelectedItem as ComboBoxItem;
@ -240,7 +236,8 @@ namespace ICSharpCode.CodeQualityAnalysis
} }
*/
/*
private void Metrics_SelectionChanged(object sender, SelectionChangedEventArgs e) private void Metrics_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
var levelItem = cbxMetrixLevel.SelectedItem as ComboBoxItem; var levelItem = cbxMetrixLevel.SelectedItem as ComboBoxItem;
@ -283,6 +280,8 @@ namespace ICSharpCode.CodeQualityAnalysis
treemap.ItemDefinition.ValuePath = "Variables"; treemap.ItemDefinition.ValuePath = "Variables";
} }
} }
*/
//http://social.msdn.microsoft.com/Forums/en-MY/wpf/thread/798e100e-249d-413f-a501-50d1db680b94 //http://social.msdn.microsoft.com/Forums/en-MY/wpf/thread/798e100e-249d-413f-a501-50d1db680b94
@ -306,5 +305,10 @@ namespace ICSharpCode.CodeQualityAnalysis
icg.StatusChanged -= ItemContainerGenerator_StatusChanged; icg.StatusChanged -= ItemContainerGenerator_StatusChanged;
} }
} }
void MenuClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
} }
} }

12
src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs

@ -12,12 +12,9 @@ using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media.Imaging;
using ICSharpCode.SharpDevelop.Widgets;
using ICSharpCode.CodeQualityAnalysis.Controls;
using ICSharpCode.CodeQualityAnalysis.Utility;
using ICSharpCode.CodeQualityAnalysis.Utility.Localizeable; using ICSharpCode.CodeQualityAnalysis.Utility.Localizeable;
using Microsoft.Win32; using ICSharpCode.SharpDevelop.Widgets;
namespace ICSharpCode.CodeQualityAnalysis namespace ICSharpCode.CodeQualityAnalysis
{ {
@ -51,6 +48,7 @@ namespace ICSharpCode.CodeQualityAnalysis
public MainWindowViewModel():base() public MainWindowViewModel():base()
{ {
this.FrmTitle = "Code Quality Analysis"; this.FrmTitle = "Code Quality Analysis";
//ResourceService.GetString("ICSharpCode.WepProjectOptionsPanel.Server");
this.btnOpenAssembly = "Open Assembly"; this.btnOpenAssembly = "Open Assembly";
#region MainTab #region MainTab
@ -207,10 +205,12 @@ namespace ICSharpCode.CodeQualityAnalysis
void ShowTreemapExecute() void ShowTreemapExecute()
{ {
var r = from ns in MainModule.Namespaces var r = from ns in MainModule.Namespaces
from type in ns.Types from type in ns.Types
from method in type.Methods from method in type.Methods
select method; select method;
Nodes = new ObservableCollection<INode>(r); Nodes = new ObservableCollection<INode>(r);
switch (selectedMetrics) switch (selectedMetrics)

Loading…
Cancel
Save