Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 9f847f6

Browse files
First, very basic implementation for FormSheet Wizard
1 parent 9767767 commit 9f847f6

15 files changed

Lines changed: 162 additions & 147 deletions

File tree

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
</ItemGroup>
8080
<ItemGroup>
8181
<Folder Include="Configuration" />
82-
<Folder Include="src\New Folder" />
8382
<Folder Include="src" />
8483
<Folder Include="src\DesignerBinding" />
8584
<Folder Include="src\Commands" />

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

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ void BaseValues()
4242
// this.ConnectionString = String.Empty;
4343
// this.CommandText = String.Empty;
4444
//
45-
// this.TopMargin = GlobalValues.DefaultPageMargin.Left;
46-
// this.BottomMargin = GlobalValues.DefaultPageMargin.Bottom;
47-
// this.LeftMargin = GlobalValues.DefaultPageMargin.Left;
48-
// this.RightMargin = GlobalValues.DefaultPageMargin.Right;
45+
this.TopMargin = GlobalValues.DefaultPageMargin.Left;
46+
this.BottomMargin = GlobalValues.DefaultPageMargin.Bottom;
47+
this.LeftMargin = GlobalValues.DefaultPageMargin.Left;
48+
this.RightMargin = GlobalValues.DefaultPageMargin.Right;
4949
//
5050
// this.availableFields = new AvailableFieldsCollection();
5151
// this.groupingsCollection = new GroupColumnCollection();
@@ -57,10 +57,9 @@ void BaseValues()
5757
}
5858

5959

60-
private string reportName;
60+
string reportName;
6161

62-
// [Category("Base Settings")]
63-
// [DefaultValueAttribute ("")]
62+
[Category("Base Settings")]
6463
public string ReportName
6564
{
6665
get {
@@ -76,8 +75,9 @@ public string ReportName
7675
}
7776
}
7877

79-
private string fileName;
80-
// [Category("Base Settings")]
78+
79+
string fileName;
80+
[Category("Base Settings")]
8181
// [XmlIgnoreAttribute]
8282
public string FileName
8383
{
@@ -93,25 +93,28 @@ public string FileName
9393
}
9494

9595

96-
// [Category("Page Settings")]
96+
[Browsable(true), Category("Base Settings")]
97+
public ReportType ReportType {get;set;}
98+
99+
100+
[Category("Page Settings")]
97101
public int BottomMargin {get;set;}
98102

99103

100-
// [Category("Page Settings")]
104+
[Category("Page Settings")]
101105
public int TopMargin {get;set;}
102106

103107

104-
105-
// [Category("Page Settings")]
108+
[Category("Page Settings")]
106109
public int LeftMargin {get;set;}
107110

108111

109-
110-
// [Category("Page Settings")]
112+
[Category("Page Settings")]
111113
public int RightMargin {get;set;}
112114

113-
private Size pageSize;
115+
Size pageSize;
114116

117+
[Category("Page Settings")]
115118
public Size PageSize {
116119
get {
117120
if (!Landscape) {
@@ -123,19 +126,15 @@ public Size PageSize {
123126
set { pageSize = value; }
124127
}
125128

126-
// [Category("Page Settings")]
127-
// public Size PageSize {get;set;}
129+
128130

129-
// [Category("Page Settings")]
131+
[Category("Page Settings")]
130132
public bool Landscape {get;set;}
131133

132-
// [Category("Data")]
134+
[Category("Data")]
133135
public PushPullModel DataModel {get;set;}
134136

135137

136-
// [Browsable(true), Category("Base Settings")]
137-
public ReportType ReportType {get;set;}
138-
139138

140139
// [Category("Parameters")]
141140
// [EditorAttribute ( typeof(ParameterCollectionEditor),

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,17 @@ public IViewContent CreateContentForFile(OpenedFile file)
4747
if (file.IsDirty) {
4848
var cmd = new ReportWizardCommand(file);
4949
cmd.Run();
50-
if (cmd.Canceled) {
50+
if (!cmd.Canceled) {
5151
LoggingService.Info("reportWizard canceled");
52+
//return null;
53+
var reportModel = cmd.ReportModel;
54+
55+
var xml = CreateFormSheetFromModel.ToXml(reportModel);
56+
var doc = new XmlDocument();
57+
doc.LoadXml(xml.ToString());
58+
var ar = XmlToArray(doc);
59+
file.SetData(ar);
60+
} else {
5261
return null;
5362
}
5463
}
@@ -71,7 +80,7 @@ public IViewContent CreateContentForFile(OpenedFile file)
7180
}
7281
7382
74-
*/
83+
*/
7584
}
7685

7786
static byte[] XmlToArray(XmlDocument doc)

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerGenerator.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ StringWriter InternalMergeFormChanges()
7878

7979
// we look only for Sections
8080
foreach (var component in viewContent.Host.Container.Components) {
81-
var b = component as BaseSection;
82-
if (b != null) {
83-
reportDesignerWriter.Save(component,xml);
81+
var section = component as BaseSection;
82+
if (section != null) {
83+
// reportDesignerWriter.Save(component,xml);
84+
reportDesignerWriter.Save(section,xml);
8485
}
8586
}
8687
//SectionCollection

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

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,42 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
5-
xmlns:System="clr-namespace:System;assembly=mscorlib"
6-
xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Reporting"
7-
xmlns:ics="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Reporting"
5+
xmlns:System="clr-namespace:System;assembly=mscorlib"
6+
xmlns:sdr="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Reporting"
7+
88
Title="Base Settings"
99
Description="Basic Settings and Layout"
10-
Background="LightGray">
10+
Background="LightGray"
11+
CanFinish="true">
1112

12-
<!-- Enter="WizardPage_Enter"
13-
Leave="WizardPage_Leave"-->
14-
15-
<!-- !xctk:WizardPage x:Class="ICSharpCode.Reporting.Addin.ReportWizard.Dialog.PageWithContext"-->
1613
<xctk:WizardPage.Resources>
17-
<ObjectDataProvider x:Key="dataFromEnum" MethodName="GetValues"
18-
ObjectType="{x:Type System:Enum}">
19-
<ObjectDataProvider.MethodParameters>
20-
<x:Type TypeName="aa:PushPullModel"/>
21-
</ObjectDataProvider.MethodParameters>
22-
</ObjectDataProvider>
14+
<ObjectDataProvider x:Key="pushpullEnum" MethodName="GetValues"
15+
ObjectType="{x:Type System:Enum}">
16+
<ObjectDataProvider.MethodParameters>
17+
<x:Type TypeName="sdr:PushPullModel"/>
18+
</ObjectDataProvider.MethodParameters>
19+
</ObjectDataProvider>
20+
21+
<ObjectDataProvider x:Key="reportTypeEnum" MethodName="GetValues"
22+
ObjectType="{x:Type System:Enum}">
23+
<ObjectDataProvider.MethodParameters>
24+
<x:Type TypeName="sdr:ReportType"/>
25+
</ObjectDataProvider.MethodParameters>
26+
</ObjectDataProvider>
2327
</xctk:WizardPage.Resources>
24-
25-
<Grid ShowGridLines="true">
28+
29+
<Grid >
2630
<Grid.RowDefinitions>
2731
<RowDefinition Height="Auto"> </RowDefinition>
2832
<RowDefinition Height="Auto"></RowDefinition>
2933
<RowDefinition Height="Auto"></RowDefinition>
3034
<RowDefinition Height="Auto"></RowDefinition>
3135
<RowDefinition Height="Auto"></RowDefinition>
3236
<RowDefinition Height="Auto"></RowDefinition>
33-
<RowDefinition Height="Auto"></RowDefinition>
34-
<RowDefinition Height="Auto"></RowDefinition>
35-
<RowDefinition Height="Auto"></RowDefinition>
36-
<RowDefinition Height="Auto"></RowDefinition>
37+
<RowDefinition Height="Auto"></RowDefinition>
38+
<RowDefinition Height="Auto"></RowDefinition>
39+
<RowDefinition Height="Auto"></RowDefinition>
40+
<RowDefinition Height="Auto"></RowDefinition>
3741
</Grid.RowDefinitions>
3842
<Grid.ColumnDefinitions>
3943
<ColumnDefinition></ColumnDefinition>
@@ -43,14 +47,17 @@ xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Repor
4347
</Grid.ColumnDefinitions>
4448

4549
<Label Content="DataModel :"></Label>
46-
<!--<RadioButton Name="_FormSheet" GroupName="DataModel" Content="FormSheet" Margin="0,5,0,5" Grid.Row="1" ></RadioButton>
47-
<RadioButton Name="_PushModel" GroupName="DataModel" Content="PushModel" Margin="0,5,0,5" Grid.Row="1" Grid.Column="1"></RadioButton>
48-
-->
49-
<ComboBox ItemsSource="{Binding Source={StaticResource dataFromEnum}}" Grid.Column="1" ></ComboBox>
50-
50+
<ComboBox Name="_DataModel" Margin="10,5,0,5"
51+
Grid.Column="1"
52+
ItemsSource="{Binding Source={StaticResource pushpullEnum}}">
53+
</ComboBox>
54+
5155
<Label Content="ReportType :" Margin="0,5,0,5" Grid.Row="2"></Label>
52-
<RadioButton Name="_FormSheetType" GroupName="ReportType" Content="FormSheet" Margin="0,5,0,5" Grid.Row="3" ></RadioButton>
53-
<RadioButton Name="_DataModelType" GroupName="ReportType" Content="PushModel" Margin="0,5,0,5" Grid.Row="3" Grid.Column="1"></RadioButton>
56+
<ComboBox Name="_ReportType" Margin="10,5,0,5"
57+
Grid.Row="2" Grid.Column="1"
58+
ItemsSource="{Binding Source={StaticResource reportTypeEnum}}">
59+
</ComboBox>
60+
5461

5562
<Label Content="Report Name :" Margin="0,5,0,5" Grid.Row="4"></Label>
5663
<TextBox Name="_ReportName" Margin="10,5,0,5" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3"></TextBox>
@@ -59,8 +66,8 @@ xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Repor
5966
<TextBox Name="_Filename" Margin="10,5,0,5" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3"></TextBox>
6067

6168
<Label Content="Page Layout :" Grid.Row="6" Margin="0,5,0,5"></Label>
62-
<RadioButton Name="_Legal" GroupName="PageLayout" Content="Legal" Grid.Row="7" Margin="0,5,0,5" ></RadioButton>
63-
<RadioButton Name="_Landscape" GroupName="PageLayout" Content="Landscape" Grid.Row="7" Grid.Column="1" Margin="0,5,0,5"></RadioButton>
69+
<RadioButton Name="_Legal" GroupName="PageLayout" Content="Legal" IsChecked="true" Grid.Row="7" Margin="0,5,0,5" ></RadioButton>
70+
<RadioButton Name="_Landscape" GroupName="PageLayout" Content="Landscape" Grid.Row="7" Grid.Column="1" Margin="0,5,0,5"></RadioButton>
6471
</Grid>
6572

6673
</xctk:WizardPage>

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
using System;
1010
using System.Windows;
11+
using ICSharpCode.Reporting.Globals;
1112
using Xceed.Wpf.Toolkit;
1213
using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels;
1314

@@ -23,6 +24,8 @@ public partial class BaseSettingsPage : WizardPage,IHasContext
2324
public BaseSettingsPage()
2425
{
2526
InitializeComponent();
27+
_DataModel.SelectedItem = PushPullModel.FormSheet;
28+
_ReportType.SelectedItem = ReportType.FormSheet;
2629
this.context = new PageOneContext();
2730
}
2831

@@ -38,21 +41,11 @@ public int PageNumber {
3841
}
3942

4043

41-
void WizardPage_Enter(object sender, RoutedEventArgs e)
42-
{
43-
44-
Console.Write("Create Context for PageOne");
45-
}
46-
47-
void WizardPage_Leave(object sender, RoutedEventArgs e)
48-
{
49-
// NewMethod();
50-
}
51-
5244
void UpdateContext()
5345
{
54-
// context.FormSheet = this._FormSheet.IsChecked == true;
55-
// context.PushModel = this._PushModel.IsChecked == true;
46+
47+
context.DataModel = (PushPullModel) _DataModel.SelectedItem;
48+
context.ReportType = (ReportType) _ReportType.SelectedItem;
5649
context.ReportName = this._ReportName.Text;
5750
context.FileName = this._Filename.Text;
5851
context.Legal = _Legal.IsChecked == true;

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020

2121
<xctk:WizardPage PageType="Interior"
2222
Title="Page 1"
23-
Description="This is the first page in the process." />
24-
<xctk:WizardPage PageType="Interior"
23+
Description="This is the first page in the process."
24+
CanFinish="True" />
25+
<!-- <xctk:WizardPage PageType="Interior"
2526
Title="Page 2"
2627
Description="This is the second page in the process" />
2728
<xctk:WizardPage PageType="Interior"
2829
Title="Last Page"
2930
Description="This is the last page in the process"
30-
CanFinish="True" />
31+
CanFinish="True" />-->
3132
</xctk:Wizard>
3233

3334
</Window>

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

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
1919
/// </summary>
2020
public partial class ReportWizard : Window
2121
{
22-
ReportWizardContext context;
23-
BaseSettingsPage baseSettingsPage;
22+
readonly ReportWizardContext context;
23+
readonly BaseSettingsPage baseSettingsPage;
2424

2525
public ReportWizard(ReportWizardContext context)
2626
{
2727
InitializeComponent();
2828
this.context = context;
2929
baseSettingsPage = new BaseSettingsPage();
30-
_wizard.Items.Insert(2,baseSettingsPage);
31-
30+
_wizard.Items.Insert(1,baseSettingsPage);
3231
}
3332

3433

@@ -44,17 +43,6 @@ void _wizard_PageChanged(object sender, RoutedEventArgs e)
4443

4544
void _wizard_Finish(object sender, RoutedEventArgs e)
4645
{
47-
var x = _wizard.Items;
48-
49-
foreach (var element in this._wizard.Items) {
50-
var isHasContext = element is IHasContext;
51-
if (isHasContext) {
52-
53-
var hasContext = (IHasContext) element;
54-
Console.WriteLine(" {0} - {1}",hasContext.PageNumber,element.ToString());
55-
}
56-
}
57-
5846
context.PageOneContext = baseSettingsPage.Context;
5947

6048
}

0 commit comments

Comments
 (0)