-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomWebDocumentViewerOperationLogger.cs
29 lines (27 loc) · 1.91 KB
/
CustomWebDocumentViewerOperationLogger.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
using System;
using System.Collections.Generic;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Caching;
using DevExpress.XtraReports.Web.WebDocumentViewer;
namespace CustomCachedDocumentSourceSerialization {
public class CustomWebDocumentViewerOperationLogger: WebDocumentViewerOperationLogger {
public override void CachedDocumentSourceSerializing(string documentId, CachedDocumentSource cachedDocumentSource, GeneratedDocumentDetails documentDetails, DocumentStorage documentStorage, PrintingSystemBase printingSystemSource) {
var serviceProvider = printingSystemSource as IServiceProvider;
var customPageDataService = serviceProvider.GetService(typeof(CustomPageDataService)) as CustomPageDataService;
if (customPageDataService != null) {
documentDetails.CustomData = new Dictionary<string, object> { [CustomPageDataService.Key] = customPageDataService.PageAdditionalData };
cachedDocumentSource.PrintingSystem.XlSheetCreated += customPageDataService.PrintingSystem_XlSheetCreated;
}
}
public override void CachedDocumentSourceDeserialized(string documentId, CachedDocumentSource cachedDocumentSource, GeneratedDocumentDetails documentDetails, DocumentStorage documentStorage) {
object customData;
if(documentDetails.CustomData != null && documentDetails.CustomData.TryGetValue(CustomPageDataService.Key, out customData)){
Dictionary<int, List<int>> customDataServiceDictionary = customData as Dictionary<int, List<int>>;
if (customDataServiceDictionary == null)
return;
var customPageDataService = new CustomPageDataService(customDataServiceDictionary);
cachedDocumentSource.PrintingSystem.XlSheetCreated += customPageDataService.PrintingSystem_XlSheetCreated;
}
}
}
}