41 changed files with 609 additions and 161 deletions
@ -0,0 +1,73 @@ |
|||||||
|
<xctk:WizardPage x:Class="ICSharpCode.Reporting.Addin.ReportWizard.Dialog.BaseSettingsPage" |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" |
||||||
|
xmlns:System="clr-namespace:System;assembly=mscorlib" |
||||||
|
xmlns:sdr="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Reporting" |
||||||
|
|
||||||
|
Title="Base Settings" |
||||||
|
Description="Basic Settings and Layout" |
||||||
|
Background="LightGray" |
||||||
|
CanFinish="true"> |
||||||
|
|
||||||
|
<xctk:WizardPage.Resources> |
||||||
|
<ObjectDataProvider x:Key="pushpullEnum" MethodName="GetValues" |
||||||
|
ObjectType="{x:Type System:Enum}"> |
||||||
|
<ObjectDataProvider.MethodParameters> |
||||||
|
<x:Type TypeName="sdr:PushPullModel"/> |
||||||
|
</ObjectDataProvider.MethodParameters> |
||||||
|
</ObjectDataProvider> |
||||||
|
|
||||||
|
<ObjectDataProvider x:Key="reportTypeEnum" MethodName="GetValues" |
||||||
|
ObjectType="{x:Type System:Enum}"> |
||||||
|
<ObjectDataProvider.MethodParameters> |
||||||
|
<x:Type TypeName="sdr:ReportType"/> |
||||||
|
</ObjectDataProvider.MethodParameters> |
||||||
|
</ObjectDataProvider> |
||||||
|
</xctk:WizardPage.Resources> |
||||||
|
|
||||||
|
<Grid > |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="Auto"> </RowDefinition> |
||||||
|
<RowDefinition Height="Auto"></RowDefinition> |
||||||
|
<RowDefinition Height="Auto"></RowDefinition> |
||||||
|
<RowDefinition Height="Auto"></RowDefinition> |
||||||
|
<RowDefinition Height="Auto"></RowDefinition> |
||||||
|
<RowDefinition Height="Auto"></RowDefinition> |
||||||
|
<RowDefinition Height="Auto"></RowDefinition> |
||||||
|
<RowDefinition Height="Auto"></RowDefinition> |
||||||
|
<RowDefinition Height="Auto"></RowDefinition> |
||||||
|
<RowDefinition Height="Auto"></RowDefinition> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition></ColumnDefinition> |
||||||
|
<ColumnDefinition></ColumnDefinition> |
||||||
|
<ColumnDefinition></ColumnDefinition> |
||||||
|
<ColumnDefinition></ColumnDefinition> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
|
||||||
|
<Label Content="DataModel :"></Label> |
||||||
|
<ComboBox Name="_DataModel" Margin="10,5,0,5" |
||||||
|
Grid.Column="1" |
||||||
|
ItemsSource="{Binding Source={StaticResource pushpullEnum}}"> |
||||||
|
</ComboBox> |
||||||
|
|
||||||
|
<Label Content="ReportType :" Margin="0,5,0,5" Grid.Row="2"></Label> |
||||||
|
<ComboBox Name="_ReportType" Margin="10,5,0,5" |
||||||
|
Grid.Row="2" Grid.Column="1" |
||||||
|
ItemsSource="{Binding Source={StaticResource reportTypeEnum}}"> |
||||||
|
</ComboBox> |
||||||
|
|
||||||
|
|
||||||
|
<Label Content="Report Name :" Margin="0,5,0,5" Grid.Row="4"></Label> |
||||||
|
<TextBox Name="_ReportName" Margin="10,5,0,5" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3"></TextBox> |
||||||
|
|
||||||
|
<Label Content="Filename :" Margin="0,5,0,5" Grid.Row="5"></Label> |
||||||
|
<TextBox Name="_Filename" Margin="10,5,0,5" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3"></TextBox> |
||||||
|
|
||||||
|
<Label Content="Page Layout :" Grid.Row="6" Margin="0,5,0,5"></Label> |
||||||
|
<RadioButton Name="_Legal" GroupName="PageLayout" Content="Legal" IsChecked="true" Grid.Row="7" Margin="0,5,0,5" ></RadioButton> |
||||||
|
<RadioButton Name="_Landscape" GroupName="PageLayout" Content="Landscape" Grid.Row="7" Grid.Column="1" Margin="0,5,0,5"></RadioButton> |
||||||
|
</Grid> |
||||||
|
|
||||||
|
</xctk:WizardPage> |
@ -0,0 +1,56 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 08.07.2014 |
||||||
|
* Time: 20:26 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Windows; |
||||||
|
using ICSharpCode.Reporting.Globals; |
||||||
|
using Xceed.Wpf.Toolkit; |
||||||
|
using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{ |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for PageOne.xamlWizardPage,IHasContext
|
||||||
|
/// </summary>
|
||||||
|
public partial class BaseSettingsPage : WizardPage,IHasContext |
||||||
|
{ |
||||||
|
PageOneContext context; |
||||||
|
|
||||||
|
public BaseSettingsPage() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
_DataModel.SelectedItem = PushPullModel.FormSheet; |
||||||
|
_ReportType.SelectedItem = ReportType.FormSheet; |
||||||
|
this.context = new PageOneContext(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public IWizardContext Context { |
||||||
|
get{ |
||||||
|
UpdateContext(); |
||||||
|
return context;} |
||||||
|
} |
||||||
|
|
||||||
|
public int PageNumber { |
||||||
|
get {return 1;} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void UpdateContext() |
||||||
|
{ |
||||||
|
|
||||||
|
context.DataModel = (PushPullModel) _DataModel.SelectedItem; |
||||||
|
context.ReportType = (ReportType) _ReportType.SelectedItem; |
||||||
|
context.ReportName = this._ReportName.Text; |
||||||
|
context.FileName = this._Filename.Text; |
||||||
|
context.Legal = _Legal.IsChecked == true; |
||||||
|
; |
||||||
|
context.Landscape = _Landscape.IsChecked == true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 16.07.2014 |
||||||
|
* Time: 20:41 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of IHasContext.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasContext |
||||||
|
{ |
||||||
|
IWizardContext Context {get;} |
||||||
|
int PageNumber {get;} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
<Window x:Class="ICSharpCode.Reporting.Addin.ReportWizard.Dialog.ReportWizard" |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" |
||||||
|
xmlns:local="clr-namespace:ICSharpCode.Reporting.Addin.ReportWizard.Dialog" |
||||||
|
Title="{Binding Title}" |
||||||
|
Height="600" Width="600"> |
||||||
|
|
||||||
|
<xctk:Wizard x:Name="_wizard" FinishButtonClosesWindow="True" |
||||||
|
Next="_wizard_Next" |
||||||
|
PageChanged="_wizard_PageChanged" |
||||||
|
Finish="_wizard_Finish" |
||||||
|
CanHelp="False"> |
||||||
|
|
||||||
|
<xctk:WizardPage PageType="Exterior" Title="Welcome to Reporting Wizard" |
||||||
|
Description="This Wizard will walk you though how to do something." /> |
||||||
|
|
||||||
|
<!-- ! <local:BaseSettingsPage ></local:BaseSettingsPage> --> |
||||||
|
|
||||||
|
|
||||||
|
<xctk:WizardPage PageType="Interior" |
||||||
|
Title="Page 1" |
||||||
|
Description="This is the first page in the process." |
||||||
|
CanFinish="True" /> |
||||||
|
<!-- <xctk:WizardPage PageType="Interior" |
||||||
|
Title="Page 2" |
||||||
|
Description="This is the second page in the process" /> |
||||||
|
<xctk:WizardPage PageType="Interior" |
||||||
|
Title="Last Page" |
||||||
|
Description="This is the last page in the process" |
||||||
|
CanFinish="True" />--> |
||||||
|
</xctk:Wizard> |
||||||
|
|
||||||
|
</Window> |
@ -0,0 +1,51 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 07.07.2014 |
||||||
|
* Time: 20:18 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Windows; |
||||||
|
using Xceed.Wpf.Toolkit; |
||||||
|
using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for Window1.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ReportWizard : Window |
||||||
|
{ |
||||||
|
readonly ReportWizardContext context; |
||||||
|
readonly BaseSettingsPage baseSettingsPage; |
||||||
|
|
||||||
|
public ReportWizard(ReportWizardContext context) |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
this.context = context; |
||||||
|
baseSettingsPage = new BaseSettingsPage(); |
||||||
|
_wizard.Items.Insert(1,baseSettingsPage); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void _wizard_Next(object sender, Xceed.Wpf.Toolkit.Core.CancelRoutedEventArgs e) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void _wizard_PageChanged(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
void _wizard_Finish(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
context.PageOneContext = baseSettingsPage.Context; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,76 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 22.07.2014 |
||||||
|
* Time: 19:37 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
using ICSharpCode.Reporting.Factories; |
||||||
|
using ICSharpCode.Reporting.Globals; |
||||||
|
using ICSharpCode.Reporting.Interfaces; |
||||||
|
|
||||||
|
|
||||||
|
using ICSharpCode.Reporting.Items; |
||||||
|
using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Addin.ReportWizard |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of ReportGenerator.
|
||||||
|
/// </summary>
|
||||||
|
public class ReportGenerator |
||||||
|
{ |
||||||
|
ReportWizardContext context; |
||||||
|
|
||||||
|
|
||||||
|
public ReportGenerator(ReportWizardContext context) |
||||||
|
{ |
||||||
|
if (context == null) |
||||||
|
throw new ArgumentNullException("context"); |
||||||
|
this.context = context; |
||||||
|
ReportModel = ReportModelFactory.Create(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void Generate() { |
||||||
|
PageOneGenerate(); |
||||||
|
CreateReportHeader(); |
||||||
|
} |
||||||
|
|
||||||
|
void PageOneGenerate() |
||||||
|
{ |
||||||
|
var pageOne = (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; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void CreateReportHeader() |
||||||
|
{ |
||||||
|
var headerText = new BaseTextItem(); |
||||||
|
headerText.Text = "Header"; |
||||||
|
headerText.Size = GlobalValues.PreferedSize; |
||||||
|
var printableWith = ReportModel.ReportSettings.PageSize.Width - ReportModel.ReportSettings.LeftMargin - ReportModel.ReportSettings.RightMargin; |
||||||
|
var x = (int)(printableWith - headerText.Size.Width) / 2; |
||||||
|
|
||||||
|
headerText.Location = new Point(x,4); |
||||||
|
ReportModel.ReportHeader.Items.Add(headerText); |
||||||
|
Console.WriteLine(""); |
||||||
|
Console.WriteLine("Createreportheader Size {0}",ReportModel.ReportHeader.Size); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public IReportModel ReportModel {get;private set;} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,52 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 08.07.2014 |
||||||
|
* Time: 19:47 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.Reporting.Interfaces; |
||||||
|
using ICSharpCode.SharpDevelop.Workbench; |
||||||
|
using ICSharpCode.Reporting.Addin.ReportWizard.Dialog; |
||||||
|
using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Addin.ReportWizard |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of ReportWizardCommand.
|
||||||
|
/// </summary>
|
||||||
|
class ReportWizardCommand: AbstractMenuCommand |
||||||
|
{ |
||||||
|
readonly OpenedFile file; |
||||||
|
|
||||||
|
public ReportWizardCommand (OpenedFile file) { |
||||||
|
if (file == null) |
||||||
|
throw new ArgumentNullException("file"); |
||||||
|
this.file = file; |
||||||
|
} |
||||||
|
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
var wizardViewModel = new ReportWizardContext(); |
||||||
|
var reportWizard = new ICSharpCode.Reporting.Addin.ReportWizard.Dialog.ReportWizard(wizardViewModel); |
||||||
|
|
||||||
|
reportWizard.ShowDialog(); |
||||||
|
if (reportWizard.DialogResult.HasValue && reportWizard.DialogResult.Value){ |
||||||
|
LoggingService.Info("ReportWizard - CreateReport"); |
||||||
|
var rg = new ReportGenerator(wizardViewModel); |
||||||
|
|
||||||
|
rg.Generate(); |
||||||
|
ReportModel = rg.ReportModel; |
||||||
|
} else { |
||||||
|
Canceled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool Canceled {get; private set;} |
||||||
|
|
||||||
|
public IReportModel ReportModel {get;private set;} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 07/12/2014 |
||||||
|
* Time: 18:20 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using ICSharpCode.Reporting.Globals; |
||||||
|
using Xceed.Wpf.Toolkit; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of PageOneViewModel.
|
||||||
|
/// </summary>
|
||||||
|
public class PageOneContext:IWizardContext |
||||||
|
{ |
||||||
|
public PushPullModel DataModel {get;set;} |
||||||
|
public ReportType ReportType {get;set;} |
||||||
|
public string ReportName {get;set;} |
||||||
|
public string FileName {get;set;} |
||||||
|
public bool Legal {get;set;} |
||||||
|
public bool Landscape {get;set;} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 07/12/2014 |
||||||
|
* Time: 18:10 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels |
||||||
|
{ |
||||||
|
|
||||||
|
public interface IWizardContext { |
||||||
|
|
||||||
|
} |
||||||
|
/// <summary>
|
||||||
|
/// Description of ReportWizardViewModel.
|
||||||
|
/// </summary>
|
||||||
|
public class ReportWizardContext:IWizardContext |
||||||
|
{ |
||||||
|
|
||||||
|
|
||||||
|
public string Title { |
||||||
|
get{ return "das ist der Title";} |
||||||
|
} |
||||||
|
|
||||||
|
IWizardContext pageOneContext; |
||||||
|
|
||||||
|
public IWizardContext PageOneContext { |
||||||
|
get { |
||||||
|
return pageOneContext; |
||||||
|
} |
||||||
|
set { |
||||||
|
pageOneContext = value; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue