-
Notifications
You must be signed in to change notification settings - Fork 0
/
IReportDesignerAPIService.vb
56 lines (48 loc) · 1.98 KB
/
IReportDesignerAPIService.vb
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
Imports DevExpress.Mvvm.UI
Imports DevExpress.Mvvm.UI.Interactivity
Imports DevExpress.Xpf.Reports.UserDesigner
Imports DevExpress.XtraReports.UI
Imports System
Imports System.Collections.Generic
Imports System.IO
Namespace ManipulateReportDesignerDocuments_MVVM
Public Interface IReportDesignerAPIService
ReadOnly Property Documents() As IEnumerable(Of ReportDesignerDocument)
ReadOnly Property ActiveDocument() As ReportDesignerDocument
Function NewReport(Optional ByVal report As XtraReport = Nothing) As ReportDesignerDocument
Function Open() As ReportDesignerDocument
Function Open(ByVal stream As Stream) As ReportDesignerDocument
End Interface
Public Class ReportDesignerAPIService
Inherits ServiceBase
Implements IReportDesignerAPIService
Private ReadOnly Property Designer() As ReportDesigner
Get
Return CType(AssociatedObject, ReportDesigner)
End Get
End Property
Public ReadOnly Property Documents() As IEnumerable(Of ReportDesignerDocument) Implements IReportDesignerAPIService.Documents
Get
Return Designer.Documents
End Get
End Property
Public ReadOnly Property ActiveDocument() As ReportDesignerDocument Implements IReportDesignerAPIService.ActiveDocument
Get
Return Designer.ActiveDocument
End Get
End Property
Public Function NewReport(Optional ByVal report As XtraReport = Nothing) As ReportDesignerDocument Implements IReportDesignerAPIService.NewReport
Dim reportFactory As Func(Of XtraReport) = Nothing
If report IsNot Nothing Then
reportFactory = Function() report
End If
Return Designer.NewDocument(reportFactory)
End Function
Public Function Open() As ReportDesignerDocument Implements IReportDesignerAPIService.Open
Return Designer.OpenDocument()
End Function
Public Function Open(ByVal stream As Stream) As ReportDesignerDocument Implements IReportDesignerAPIService.Open
Return Designer.OpenDocument(stream)
End Function
End Class
End Namespace