-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWizardCustomizationService.cs
More file actions
59 lines (54 loc) · 2.55 KB
/
Copy pathWizardCustomizationService.cs
File metadata and controls
59 lines (54 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System.ComponentModel.Design;
using DevExpress.AIIntegration.Reporting;
using DevExpress.AIIntegration.Reporting.Wizard;
using DevExpress.AIIntegration.Reporting.Wizard.Presenters;
using DevExpress.AIIntegration.Reporting.Wizard.Views;
using DevExpress.AIIntegration.WinForms;
using DevExpress.AIIntegration.WinForms.Reporting;
using DevExpress.AIIntegration.WinForms.Reporting.Wizard;
using DevExpress.AIIntegration.WinForms.Reporting.Wizard.Views;
using DevExpress.Data.Utils;
using DevExpress.DataAccess.UI.Wizard;
using DevExpress.DataAccess.Wizard.Model;
using DevExpress.XtraEditors.AI.Native;
using DevExpress.XtraReports.Design;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Wizards;
namespace AIWizardCustomizationExample.Customization {
internal class WizardCustomizationService : IWizardCustomizationService {
public void CustomizeReportWizard(IWizardCustomization<XtraReportModel> tool) {
tool.RegisterAIReportWizard();
tool.StartPage = typeof(ChooseReportCreationModePage<XtraReportModel>);
tool.RegisterPage<ChooseReportCreationModePage<XtraReportModel>, ChooseReportCreationModePage<XtraReportModel>>();
tool.RegisterPageView<IChooseReportCreationModePageView, ChooseReportCreationModePageView>();
}
public void CustomizeDataSourceWizard(IWizardCustomization<XtraReportModel> tool) { }
public bool TryCreateDataSource(IDataSourceModel model, out object dataSource, out string dataMember) {
dataSource = null;
dataMember = null;
return false;
}
public bool TryCreateReport(IDesignerHost designerHost, XtraReportModel model, object dataSource, string dataMember) {
if(model.GetIsAIReportType()) {
DoWithOverlay(designerHost, () => {
var builder = new AIReportBuilder(designerHost, dataSource, dataMember);
builder.Build((XtraReport)designerHost.RootComponent, model);
});
return true;
}
return false;
}
void DoWithOverlay(IDesignerHost designerHost, Action action) {
Control control = designerHost.GetService<ReportTabControlBase>();
using(var waitForm = new AIOverlayForm()) {
waitForm.ShowLoading(control);
try {
action();
waitForm.Close();
} catch(Exception ex) {
waitForm.ShowError(control, ex.Message, false);
}
}
}
}
}