-
Notifications
You must be signed in to change notification settings - Fork 0
/
IReportDesignerAPIService.cs
40 lines (33 loc) · 1.42 KB
/
IReportDesignerAPIService.cs
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
using DevExpress.Mvvm.UI;
using DevExpress.Mvvm.UI.Interactivity;
using DevExpress.Xpf.Reports.UserDesigner;
using DevExpress.XtraReports.UI;
using System;
using System.Collections.Generic;
using System.IO;
namespace ManipulateReportDesignerDocuments_MVVM {
public interface IReportDesignerAPIService {
IEnumerable<ReportDesignerDocument> Documents { get; }
ReportDesignerDocument ActiveDocument { get; }
ReportDesignerDocument NewReport(XtraReport report = null);
ReportDesignerDocument Open();
ReportDesignerDocument Open(Stream stream);
}
public class ReportDesignerAPIService : ServiceBase, IReportDesignerAPIService {
ReportDesigner Designer => (ReportDesigner)AssociatedObject;
public IEnumerable<ReportDesignerDocument> Documents => Designer.Documents;
public ReportDesignerDocument ActiveDocument => Designer.ActiveDocument;
public ReportDesignerDocument NewReport(XtraReport report = null) {
Func<XtraReport> reportFactory = null;
if(report != null)
reportFactory = () => report;
return Designer.NewDocument(reportFactory);
}
public ReportDesignerDocument Open() {
return Designer.OpenDocument();
}
public ReportDesignerDocument Open(Stream stream) {
return Designer.OpenDocument(stream);
}
}
}