Browse Source

Cleanup

pull/416/merge
Peter Forstmeier 11 years ago
parent
commit
08fee41426
  1. 3
      data/resources/StringResources.resx
  2. 8
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs
  3. 8
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml
  4. 8
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs
  5. 11
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/PushDataReport.xaml
  6. 65
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/PushDataReport.xaml.cs
  7. 5
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs
  8. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs
  9. 6
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Toolbox/ToolboxProvider.cs
  10. 4
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs
  11. 10
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs

3
data/resources/StringResources.resx

@ -8294,4 +8294,7 @@ a line break</value>
<data name="SharpReport.Wizard.PageLayout" xml:space="preserve"> <data name="SharpReport.Wizard.PageLayout" xml:space="preserve">
<value>Page Layout </value> <value>Page Layout </value>
</data> </data>
<data name="SharpReport.Wizard.PushModel.NoProject" xml:space="preserve">
<value>No project selected, please enter FieldNames</value>
</data>
</root> </root>

8
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs

@ -34,7 +34,7 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems
// this.GraphicsUnit = GraphicsUnit.Pixel; // this.GraphicsUnit = GraphicsUnit.Pixel;
// this.Padding = new Padding(5); // this.Padding = new Padding(5);
// this.DefaultFont = GlobalValues.DefaultFont; // this.DefaultFont = GlobalValues.DefaultFont;
this.ReportType = ReportType.FormSheet; // this.ReportType = ReportType.FormSheet;
// //
this.DataModel = PushPullModel.FormSheet; this.DataModel = PushPullModel.FormSheet;
// //
@ -93,9 +93,9 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems
} }
[Browsable(true), Category("Base Settings")] // [Browsable(true), Category("Base Settings")]
public ReportType ReportType {get;set;} // public ReportType ReportType {get;set;}
//
[Category("Page Settings")] [Category("Page Settings")]
public int BottomMargin {get;set;} public int BottomMargin {get;set;}

8
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml

@ -19,12 +19,12 @@
</ObjectDataProvider.MethodParameters> </ObjectDataProvider.MethodParameters>
</ObjectDataProvider> </ObjectDataProvider>
<ObjectDataProvider x:Key="reportTypeEnum" MethodName="GetValues" <!-- <ObjectDataProvider x:Key="reportTypeEnum" MethodName="GetValues"
ObjectType="{x:Type System:Enum}"> ObjectType="{x:Type System:Enum}">
<ObjectDataProvider.MethodParameters> <ObjectDataProvider.MethodParameters>
<x:Type TypeName="sdr:ReportType"/> <x:Type TypeName="sdr:ReportType"/>
</ObjectDataProvider.MethodParameters> </ObjectDataProvider.MethodParameters>
</ObjectDataProvider> </ObjectDataProvider>-->
</xctk:WizardPage.Resources> </xctk:WizardPage.Resources>
<Grid> <Grid>
@ -54,11 +54,11 @@
ItemsSource="{Binding Source={StaticResource pushpullEnum}}"> ItemsSource="{Binding Source={StaticResource pushpullEnum}}">
</ComboBox> </ComboBox>
<Label Content="ReportType :" Margin="0,5,0,5" Grid.Column="1" Grid.Row="2"></Label> <!--<Label Content="ReportType :" Margin="0,5,0,5" Grid.Column="1" Grid.Row="2"></Label>
<ComboBox Name="_ReportType" Margin="10,5,0,5" <ComboBox Name="_ReportType" Margin="10,5,0,5"
Grid.Row="2" Grid.Column="2" Grid.Row="2" Grid.Column="2"
ItemsSource="{Binding Source={StaticResource reportTypeEnum}}"> ItemsSource="{Binding Source={StaticResource reportTypeEnum}}">
</ComboBox> </ComboBox>-->
<Label Content="{core:Localize SharpReport.Wizard.BaseSettings.ReportName}" Margin="0,5,0,5" Grid.Column="1" Grid.Row="4"></Label> <Label Content="{core:Localize SharpReport.Wizard.BaseSettings.ReportName}" Margin="0,5,0,5" Grid.Column="1" Grid.Row="4"></Label>
<TextBox Name="_ReportName" Margin="10,5,0,5" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="3"></TextBox> <TextBox Name="_ReportName" Margin="10,5,0,5" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="3"></TextBox>

8
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{
{ {
InitializeComponent(); InitializeComponent();
_DataModel.SelectedItem = PushPullModel.FormSheet; _DataModel.SelectedItem = PushPullModel.FormSheet;
_ReportType.SelectedItem = ReportType.FormSheet; // _ReportType.SelectedItem = ReportType.FormSheet;
_Legal.IsChecked = true; _Legal.IsChecked = true;
this.context = new PageOneContext(); this.context = new PageOneContext();
} }
@ -44,7 +44,7 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{
void UpdateContext(){ void UpdateContext(){
context.DataModel = (PushPullModel) _DataModel.SelectedItem; context.DataModel = (PushPullModel) _DataModel.SelectedItem;
context.ReportType = (ReportType) _ReportType.SelectedItem; // context.ReportType = (ReportType) _ReportType.SelectedItem;
context.ReportName = this._ReportName.Text; context.ReportName = this._ReportName.Text;
context.FileName = this._Filename.Text; context.FileName = this._Filename.Text;
context.Legal = _Legal.IsChecked == true; context.Legal = _Legal.IsChecked == true;
@ -59,7 +59,7 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{
switch (pushPullModel) { switch (pushPullModel) {
case PushPullModel.PushData: { case PushPullModel.PushData: {
this._ReportType.SelectedItem = ReportType.DataReport; // this._ReportType.SelectedItem = ReportType.DataReport;
this.CanFinish = false; this.CanFinish = false;
this.CanSelectNextPage = true; this.CanSelectNextPage = true;
break; break;
@ -74,7 +74,7 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{
case PushPullModel.FormSheet: { case PushPullModel.FormSheet: {
this.CanFinish = true; this.CanFinish = true;
CanSelectNextPage = false; CanSelectNextPage = false;
this._ReportType.SelectedItem = ReportType.FormSheet; // this._ReportType.SelectedItem = ReportType.FormSheet;
break; break;
} }
} }

11
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/PushDataReport.xaml

@ -12,7 +12,7 @@
CanSelectPreviousPage="true" CanSelectPreviousPage="true"
CanSelectNextPage="false"> CanSelectNextPage="false">
<Grid> <Grid ShowGridLines="True">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition>
@ -23,12 +23,13 @@
<RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="200"></RowDefinition> <RowDefinition Height="200"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Name="_projTxt" Text="{core:Localize SharpReport.Wizard.PushModel.SelectProject}"
FontSize="15" ></TextBlock>
<TextBlock Text="{core:Localize SharpReport.Wizard.PushModel.SelectProject}" <ComboBox Name="_cboTypes" Visibility="Hidden" Grid.Row="1" SelectionChanged="_cboTypes_SelectionChanged" MinWidth="150" ></ComboBox>
Grid.ColumnSpan="2" FontSize="15" ></TextBlock>
<ComboBox Name="_cboTypes" Visibility="Hidden" Grid.Row="1" SelectionChanged="_cboTypes_SelectionChanged" MinWidth="100" ></ComboBox>
<TextBlock Text="{core:Localize SharpReport.Wizard.PushModel.AvailableFields}" FontSize="15" Grid.Column ="1" Margin="15,0,0,0"></TextBlock> <TextBlock Name="_availTxt" Visibility="Hidden " Text="{core:Localize SharpReport.Wizard.PushModel.AvailableFields}" FontSize="15" Grid.Column ="1" Margin="15,0,0,0"></TextBlock>
<DataGrid Name="_DataGrid" <DataGrid Name="_DataGrid"
ItemsSource="{Binding}" ItemsSource="{Binding}"
CanUserAddRows="True" CanUserAddRows="True"

65
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/PushDataReport.xaml.cs

@ -8,12 +8,13 @@
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.Reporting.BaseClasses; using ICSharpCode.Reporting.BaseClasses;
using Xceed.Wpf.Toolkit; using Xceed.Wpf.Toolkit;
using ICSharpCode.Reporting.Addin.Globals; using ICSharpCode.Reporting.Addin.Globals;
using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels;
using System.Linq;
namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
{ {
@ -31,17 +32,19 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
items = new List<AbstractColumn>(); items = new List<AbstractColumn>();
_DataGrid.ItemsSource = items; _DataGrid.ItemsSource = items;
this.context = new PushModelContext(); this.context = new PushModelContext();
var data = new AbstractColumn("MyColumn",typeof(string));
items.Add(data);
cboType.ItemsSource = GlobalLists.DataTypeList(); cboType.ItemsSource = GlobalLists.DataTypeList();
var definitions = GetTypeDefinitions();
if (definitions != null) { var definitions = GetTypeDefinitions();
if (definitions.Any()) {
_cboTypes.Visibility = System.Windows.Visibility.Visible; _cboTypes.Visibility = System.Windows.Visibility.Visible;
_availTxt.Visibility = System.Windows.Visibility.Visible;
_cboTypes.ItemsSource = definitions; _cboTypes.ItemsSource = definitions;
_cboTypes.SelectedIndex = 0; _cboTypes.SelectedIndex = 0;
} else {
var data = new AbstractColumn("MyColumn", typeof(string));
items.Add(data);
_projTxt.Text = ResourceService.GetString("SharpReport.Wizard.PushModel.NoProject");
} }
} }
static IEnumerable<ITypeDefinition> GetTypeDefinitions() static IEnumerable<ITypeDefinition> GetTypeDefinitions()
@ -57,15 +60,16 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
void _cboTypes_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e){ void _cboTypes_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e){
var s = (ITypeDefinition)e.AddedItems[0]; var typeDefinition = (ITypeDefinition)e.AddedItems[0];
var l = CreateItemsSource(s); var itemsList = CreateItemsSource(typeDefinition);
if (l.Count > 0) { if (itemsList.Count > 0) {
_DataGrid.ItemsSource = l; _DataGrid.ItemsSource = itemsList;
} }
} }
static List<AbstractColumn> CreateItemsSource(ITypeDefinition s){
return s.Properties.Select(p => new AbstractColumn(){ static List<AbstractColumn> CreateItemsSource(ITypeDefinition typeDefinitions){
return typeDefinitions.Properties.Select(p => new AbstractColumn(){
ColumnName = p.Name, ColumnName = p.Name,
DataTypeName = p.ReturnType.ReflectionName DataTypeName = p.ReturnType.ReflectionName
}).ToList(); }).ToList();
@ -90,44 +94,7 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
get {return WizardPageType.PushModelPage;} get {return WizardPageType.PushModelPage;}
} }
#endregion #endregion
} }
/*
private void PopulateTestItems()
{
TestItems = new ObservableCollection<TestItem>();
for (int i = 0; i < 5; i++)
{
TestItem ti = new TestItem();
ti.Name = "TestItem" + i;
ti.IsSelected = true;
TestItems.Add(ti);
}
}
private bool _AllSelected;
public bool AllSelected
{
get { return _AllSelected; }
set
{
_AllSelected = value;
TestItems.ToList().ForEach(x => x.IsSelected = value);
NotifyPropertyChanged(m => m.AllSelected);
}
}
private ObservableCollection<TestItem> _TestItems;
public ObservableCollection<TestItem> TestItems
{
get { return _TestItems; }
set
{
_TestItems = value;
NotifyPropertyChanged(m => m.TestItems);
}
}*/
} }

5
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs

@ -71,7 +71,7 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard
reportSettings.FileName = pageOneContext.FileName; reportSettings.FileName = pageOneContext.FileName;
reportSettings.Landscape = !pageOneContext.Legal; reportSettings.Landscape = !pageOneContext.Legal;
reportSettings.ReportName = pageOneContext.ReportName; reportSettings.ReportName = pageOneContext.ReportName;
reportSettings.ReportType = pageOneContext.ReportType; // reportSettings.ReportType = pageOneContext.ReportType;
return reportSettings; return reportSettings;
} }
@ -184,7 +184,8 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard
static bool IsDataReport(ReportWizardContext context) static bool IsDataReport(ReportWizardContext context)
{ {
var poc = (PageOneContext)context.PageOneContext; var poc = (PageOneContext)context.PageOneContext;
return poc.ReportType.Equals(ReportType.DataReport); // return poc.ReportType.Equals(ReportType.DataReport);
return poc.DataModel != PushPullModel.FormSheet;
} }

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs

@ -18,7 +18,7 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels
public class PageOneContext:IWizardContext public class PageOneContext:IWizardContext
{ {
public PushPullModel DataModel {get;set;} public PushPullModel DataModel {get;set;}
public ReportType ReportType {get;set;} // public ReportType ReportType {get;set;}
public string ReportName {get;set;} public string ReportName {get;set;}
public string FileName {get;set;} public string FileName {get;set;}
public bool Legal {get;set;} public bool Legal {get;set;}

6
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Toolbox/ToolboxProvider.cs

@ -157,13 +157,13 @@ namespace ICSharpCode.Reporting.Addin.Toolbox
/// <returns>Bitmap</returns> /// <returns>Bitmap</returns>
static Bitmap CircleBitmap() static Bitmap CircleBitmap()
{ {
Bitmap b = new Bitmap (19,19); var bmp = new Bitmap (19,19);
using (Graphics g = Graphics.FromImage (b)){ using (var g = Graphics.FromImage (bmp)){
g.DrawEllipse (new Pen(Color.Black, 1), g.DrawEllipse (new Pen(Color.Black, 1),
1,1, 1,1,
17,17); 17,17);
} }
return b; return bmp;
} }

4
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs

@ -37,12 +37,12 @@ namespace ICSharpCode.Reporting.Globals
/// FormSheet means a blank form with Labels, Lines and Checkboxes /// FormSheet means a blank form with Labels, Lines and Checkboxes
/// DataReport handles all Reports with Data /// DataReport handles all Reports with Data
/// </summary> /// </summary>
public enum ReportType { /*public enum ReportType {
FormSheet, FormSheet,
DataReport, DataReport,
} }
*/
public enum ReportSection { public enum ReportSection {
ReportHeader, ReportHeader,
ReportPageHeader, ReportPageHeader,

10
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs

@ -65,7 +65,7 @@ namespace ICSharpCode.Reporting.Items
// this.GraphicsUnit = GraphicsUnit.Pixel; // this.GraphicsUnit = GraphicsUnit.Pixel;
// this.Padding = new Padding(5); // this.Padding = new Padding(5);
// this.DefaultFont = GlobalValues.DefaultFont; // this.DefaultFont = GlobalValues.DefaultFont;
ReportType = ReportType.FormSheet; // ReportType = ReportType.FormSheet;
// //
this.DataModel = PushPullModel.FormSheet; this.DataModel = PushPullModel.FormSheet;
// //
@ -124,10 +124,10 @@ namespace ICSharpCode.Reporting.Items
} }
} }
//
[Browsable(true), Category("Base Settings")] // [Browsable(true), Category("Base Settings")]
public ReportType ReportType {get;set;} // public ReportType ReportType {get;set;}
//
[Browsable(true), Category("Base Settings")] [Browsable(true), Category("Base Settings")]
public PushPullModel DataModel {get;set;} public PushPullModel DataModel {get;set;}

Loading…
Cancel
Save