Mini Kabibi Habibi
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using DevExpress.XtraReports.Service.Extensions;
using DevExpress.XtraReports.UI;
using ReportSilverlightDemo.ReportDataConfigurators;
namespace ReportSilverlightDemo.Extensions {
[Export(typeof(IDataSourceService))]
public class DataSourceService : IDataSourceService {
static readonly IDictionary<Type, IReportDataConfigurator> dataConfigurators = new Dictionary<Type, IReportDataConfigurator>();
static DataSourceService() {
dataConfigurators[typeof(XtraReportsDemos.Charts.Report)] = new ChartReportDataConfigurator();
dataConfigurators[typeof(XtraReportsDemos.DrillDownReport.DrillDownReport)] = new DrillDownReportDataConfigurator();
dataConfigurators[typeof(XtraReportsDemos.MasterDetailReport.Report)] = new MasterDetailReportDataConfigurator();
dataConfigurators[typeof(XtraReportsDemos.PivotGridAndChart.Report)] = new PivotGridAndChartReportDataConfigurator();
dataConfigurators[typeof(XtraReportsDemos.PivotGrid.Report)] = new PivotGridReportDataConfigurator();
dataConfigurators[typeof(XtraReportsDemos.SideBySideReports.EmployeeComparisonReport)] = new SideBySideReportDataConfigurator();
}
#region IDataSourceService Members
void IDataSourceService.RegisterDataSources(XtraReport report, string reportName) {
IReportDataConfigurator dataConfigurator = null;
if(dataConfigurators.TryGetValue(report.GetType(), out dataConfigurator)) {
dataConfigurator.RegisterDataSources(report);
}
}
void IDataSourceService.FillDataSources(XtraReport report, string reportName, bool isDesignSessionActive) {
IReportDataConfigurator dataConfigurator = null;
if(dataConfigurators.TryGetValue(report.GetType(), out dataConfigurator)) {
dataConfigurator.FillDataSources(report);
}
}
#endregion
}
}