1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Data;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Xml;
- using ComPDFKit.NativeMethod;
- using Compdfkit_Tools.Helper;
- namespace PDFViewer
- {
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App: Application
- {
- static public bool DefaultPDFLoaded = false;
- public static FilePathList OpenedFilePathList = new FilePathList();
- protected override void OnStartup(StartupEventArgs e)
- {
- string str = this.GetType().Assembly.Location;
- base.OnStartup(e);
- LicenseVerify();
- FileHistoryHelper<PDFFileInfo>.Instance.LoadHistory();
- }
-
- private static bool LicenseVerify()
- {
- bool result = false;
- result = CPDFSDKVerifier.LoadNativeLibrary();
- if (!result)
- return false;
- SDKLicenseHelper sdkLicenseHelper = new SDKLicenseHelper();
- LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(sdkLicenseHelper.key, sdkLicenseHelper.secret);
- if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
- return false;
- return result;
- }
- }
- public class FilePathList : List<string>
- {
- public new void Add(string item)
- {
- base.Add(item);
- YourCustomFunction(item);
- }
- private void YourCustomFunction(string item)
- {
- PDFFileInfo fileInfo = new PDFFileInfo();
- fileInfo.FilePath = item;
- fileInfo.FileName = Path.GetFileName(item);
- fileInfo.FileSize = CommonHelper.GetFileSize(fileInfo.FilePath);
- fileInfo.OpenDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- FileHistoryHelper<PDFFileInfo>.Instance.AddHistory(fileInfo);
- FileHistoryHelper<PDFFileInfo>.Instance.SaveHistory();
- }
- }
- }
|