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 @@ @@ -14,6 +14,7 @@
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">
@ -40,6 +41,7 @@ @@ -40,6 +41,7 @@
<RowDefinition
Height="Auto" />
</Grid.RowDefinitions>
<!--
<ToolBarTray
Background="White"
Grid.Row="0">
@ -50,7 +52,17 @@ @@ -50,7 +52,17 @@
Click="btnOpenAssembly_Click"
Margin="0 0 5 0"></Button>
</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
Grid.Row="1"
IsEnabled="{Binding MainTabEnable}">
@ -147,6 +159,7 @@ @@ -147,6 +159,7 @@
x:Name="matrixControl"></Graph:TreeMatrixControl>
</TabItem>
<!-- Initial version of Thomaz
<TabItem
Header="{Binding TabMetrics}"
IsEnabled="{Binding MetrixTabEnable}">
@ -222,7 +235,8 @@ @@ -222,7 +235,8 @@
</datavis:TreeMap>
</Grid>
</TabItem>
-->
<TabItem
Header="{Binding TabMetrics}"
IsEnabled="{Binding MetrixTabEnable}">
@ -293,9 +307,8 @@ @@ -293,9 +307,8 @@
<util:ComboBoxWithCommand Width="200" Margin="4,0,0,0"
ItemsSource="{Binding Source={StaticResource Metrics}}"
SelectedItem="{Binding SelectedMetrics}"
Command="{Binding ShowTreeMap}">
<util:ComboBoxWithCommand.ItemTemplate>
<DataTemplate>
<Label Content="{Binding Path=.,Mode=OneWay,

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

@ -2,10 +2,8 @@ @@ -2,10 +2,8 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
@ -58,9 +56,6 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -58,9 +56,6 @@ namespace ICSharpCode.CodeQualityAnalysis
private void btnOpenAssembly_Click(object sender, RoutedEventArgs e)
{
var dataContext = this.DataContext as MainWindowViewModel;
var fileDialog = new OpenFileDialog
{
Filter = "Component Files (*.dll, *.exe)|*.dll;*.exe"
@ -71,6 +66,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -71,6 +66,7 @@ namespace ICSharpCode.CodeQualityAnalysis
if (String.IsNullOrEmpty(fileDialog.FileName))
return;
var dataContext = this.DataContext as MainWindowViewModel;
dataContext.ProgressbarVisible = Visibility.Visible;
dataContext.AssemblyStatsVisible = Visibility.Hidden;
dataContext.FileName = System.IO.Path.GetFileName(fileDialog.FileName);
@ -214,7 +210,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -214,7 +210,7 @@ namespace ICSharpCode.CodeQualityAnalysis
encoder.Save(outStream);
}
}
/*
private void MetricLevel_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var comboBoxItem = cbxMetrixLevel.SelectedItem as ComboBoxItem;
@ -240,7 +236,8 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -240,7 +236,8 @@ namespace ICSharpCode.CodeQualityAnalysis
}
*/
/*
private void Metrics_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var levelItem = cbxMetrixLevel.SelectedItem as ComboBoxItem;
@ -283,6 +280,8 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -283,6 +280,8 @@ namespace ICSharpCode.CodeQualityAnalysis
treemap.ItemDefinition.ValuePath = "Variables";
}
}
*/
//http://social.msdn.microsoft.com/Forums/en-MY/wpf/thread/798e100e-249d-413f-a501-50d1db680b94
@ -306,5 +305,10 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -306,5 +305,10 @@ namespace ICSharpCode.CodeQualityAnalysis
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; @@ -12,12 +12,9 @@ using System.ComponentModel;
using System.Linq;
using System.Windows;
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 Microsoft.Win32;
using ICSharpCode.SharpDevelop.Widgets;
namespace ICSharpCode.CodeQualityAnalysis
{
@ -51,6 +48,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -51,6 +48,7 @@ namespace ICSharpCode.CodeQualityAnalysis
public MainWindowViewModel():base()
{
this.FrmTitle = "Code Quality Analysis";
//ResourceService.GetString("ICSharpCode.WepProjectOptionsPanel.Server");
this.btnOpenAssembly = "Open Assembly";
#region MainTab
@ -207,10 +205,12 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -207,10 +205,12 @@ namespace ICSharpCode.CodeQualityAnalysis
void ShowTreemapExecute()
{
var r = from ns in MainModule.Namespaces
from type in ns.Types
from method in type.Methods
select method;
select method;
Nodes = new ObservableCollection<INode>(r);
switch (selectedMetrics)

Loading…
Cancel
Save