diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj
index 9fec4e1330..f038280feb 100644
--- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj
@@ -165,8 +165,10 @@
+
+
diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs
index ec357aff60..e08b8f28a5 100644
--- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs
@@ -44,8 +44,8 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{
return context;}
}
- public int PageNumber {
- get {return 1;}
+ public WizardPageType ReportPageType {
+ get {return WizardPageType.BaseSettingsPage;}
}
diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/IHasContext.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/IHasContext.cs
index d2479d2600..2225919901 100644
--- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/IHasContext.cs
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/IHasContext.cs
@@ -17,6 +17,7 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
public interface IHasContext
{
IWizardContext Context {get;}
- int PageNumber {get;}
+
+ WizardPageType ReportPageType {get;}
}
}
diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/PushDataReport.xaml b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/PushDataReport.xaml
index 4d17ce77b6..5c2fb63226 100644
--- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/PushDataReport.xaml
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/PushDataReport.xaml
@@ -9,7 +9,7 @@
Title="SharpDevelop Reporting"
Description="Welcome to Sharpdevelop Reporting Wizard"
PageType="Interior"
- NextButtonVisibility="Visible"
+ CanFinish="true"
CancelButtonVisibility="Visible">
@@ -22,7 +22,7 @@
ItemsSource="{Binding}"
CanUserAddRows="True"
CanUserDeleteRows="True"
-
+
AutoGenerateColumns="False" Grid.Row="1" Margin="30,10,30,5">
diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml
index 4632743569..34166be08c 100644
--- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml
@@ -13,6 +13,7 @@
PageChanged="_wizard_PageChanged"
Finish="_wizard_Finish"
CanHelp="False">
+
diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs
index 862bda9c94..3bc13a9246 100644
--- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs
@@ -14,6 +14,7 @@ using System.Windows;
using System.Windows.Media.Imaging;
using ICSharpCode.SharpDevelop;
using Xceed.Wpf.Toolkit;
+using ICSharpCode.Reporting.Addin.ReportWizard.Dialog;
using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels;
using System.Linq;
@@ -48,9 +49,29 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
void _wizard_Finish(object sender, RoutedEventArgs e)
{
- context.PageOneContext = baseSettingsPage.Context;
-
+ foreach (WizardPage element in _wizard.Items) {
+ var hc = element as IHasContext;
+ if (hc != null) {
+ UpdateContext(hc);
+ }
+ }
}
+
+ void UpdateContext(IHasContext hc)
+ {
+
+ switch (hc.ReportPageType) {
+ case WizardPageType.BaseSettingsPage:{
+ context.PageOneContext = hc.Context;
+ break;
+ }
+
+ case WizardPageType.PushModelPage: {
+ context.PushModelContext = hc.Context;
+ break;
+ }
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs
index 807be02f9b..9c89d4d66d 100644
--- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs
@@ -23,43 +23,65 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard
///
public class ReportGenerator
{
- ReportWizardContext context;
-
-
- public ReportGenerator(ReportWizardContext context)
+ const int gap = 10;
+
+ public ReportGenerator()
{
- if (context == null)
- throw new ArgumentNullException("context");
- this.context = context;
ReportModel = ReportModelFactory.Create();
}
- public void Generate() {
- PageOneGenerate();
- CreateReportHeader();
+ public void Generate(ReportWizardContext context) {
+ if (context == null)
+ throw new ArgumentNullException("context");
+ GenerateBaseSettings(context);
+ GeneratePushModel(context);
+ CreateReportHeader(context);
}
- void PageOneGenerate()
- {
- var pageOne = (PageOneContext)context.PageOneContext;
+
+ void GenerateBaseSettings (ReportWizardContext context) {
+ var pageOneContext = (PageOneContext)context.PageOneContext;
var reportSettings = ReportModel.ReportSettings;
- reportSettings.DataModel = pageOne.DataModel;
- reportSettings.FileName = pageOne.FileName;
- if (pageOne.Legal) {
- reportSettings.Landscape = false;
- } else {
- reportSettings.Landscape = true;
- }
- reportSettings.ReportName = pageOne.ReportName;
- reportSettings.ReportType = pageOne.ReportType;
+ reportSettings.DataModel = pageOneContext.DataModel;
+ reportSettings.FileName = pageOneContext.FileName;
+ reportSettings.Landscape = !pageOneContext.Legal;
+ reportSettings.ReportName = pageOneContext.ReportName;
+ reportSettings.ReportType = pageOneContext.ReportType;
}
- void CreateReportHeader()
- {
+ void GeneratePushModel(ReportWizardContext context){
+ var pushModelContext = (PushModelContext)context.PushModelContext;
+ var xLocation = 5;
+ foreach (var element in pushModelContext.Items) {
+ var dataItem = new BaseDataItem(){
+ Name = element.ColumnName,
+ Text = element.ColumnName,
+ ColumnName = element.ColumnName,
+ DataType = element.DataTypeName
+ };
+
+ var location = new Point(xLocation,4);
+ dataItem.Location = location;
+ dataItem.Size = GlobalValues.PreferedSize;
+ xLocation = xLocation + GlobalValues.PreferedSize.Width + gap;
+ Console.WriteLine("Create dataItem with {0} - {1}items",dataItem.Location,dataItem.Size);
+ ReportModel.DetailSection.Items.Add(dataItem);
+ }
+ }
+
+
+ void CreateReportHeader(ReportWizardContext context){
+ var pageOneContext = (PageOneContext)context.PageOneContext;
var headerText = new BaseTextItem();
- headerText.Text = "Header";
+
+ if (String.IsNullOrEmpty(pageOneContext.ReportName)) {
+ headerText.Text = GlobalValues.DefaultReportName;
+ } else {
+ headerText.Text = pageOneContext.ReportName;
+ }
+
headerText.Size = GlobalValues.PreferedSize;
var printableWith = ReportModel.ReportSettings.PageSize.Width - ReportModel.ReportSettings.LeftMargin - ReportModel.ReportSettings.RightMargin;
var x = (int)(printableWith - headerText.Size.Width) / 2;
diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs
index 387ca1acb5..2d9e920fa3 100644
--- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs
@@ -36,9 +36,9 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard
reportWizard.ShowDialog();
if (reportWizard.DialogResult.HasValue && reportWizard.DialogResult.Value){
LoggingService.Info("ReportWizard - CreateReport");
- var rg = new ReportGenerator(wizardViewModel);
+ var rg = new ReportGenerator();
- rg.Generate();
+ rg.Generate(wizardViewModel);
ReportModel = rg.ReportModel;
} else {
Canceled = true;
diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PushModelContext.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PushModelContext.cs
new file mode 100644
index 0000000000..0fa6a2ad65
--- /dev/null
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PushModelContext.cs
@@ -0,0 +1,24 @@
+/*
+ * Created by SharpDevelop.
+ * User: Peter Forstmeier
+ * Date: 12.08.2014
+ * Time: 19:51
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+using System;
+using System.Collections.Generic;
+using ICSharpCode.Reporting.BaseClasses;
+
+namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels
+{
+ ///
+ /// Description of PushModelContent.
+ ///
+ ///
+ public class PushModelContext:IWizardContext
+ {
+ public List Items {get;set;}
+ }
+
+}
diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/ReportWizardContext.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/ReportWizardContext.cs
index 074f032a60..bf663356b8 100644
--- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/ReportWizardContext.cs
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/ReportWizardContext.cs
@@ -35,5 +35,16 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels
pageOneContext = value;
}
}
+
+ IWizardContext pushModelContext;
+
+ public IWizardContext PushModelContext {
+ get {
+ return pushModelContext;
+ }
+ set {
+ pushModelContext = value;
+ }
+ }
}
}
diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/WizardPageType.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/WizardPageType.cs
new file mode 100644
index 0000000000..0a3852c2a1
--- /dev/null
+++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/WizardPageType.cs
@@ -0,0 +1,20 @@
+/*
+ * Created by SharpDevelop.
+ * User: Peter Forstmeier
+ * Date: 14.08.2014
+ * Time: 19:27
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+using System;
+
+namespace ICSharpCode.Reporting.Addin.ReportWizard
+{
+ ///
+ /// Description of WizardPageType.
+ ///
+ public enum WizardPageType {
+ BaseSettingsPage,
+ PushModelPage
+ }
+}