App.xaml.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Reflection;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Xml;
  10. using ComPDFKit.NativeMethod;
  11. using Compdfkit_Tools.Helper;
  12. namespace PDFViewer
  13. {
  14. /// <summary>
  15. /// Interaction logic for App.xaml
  16. /// </summary>
  17. public partial class App: Application
  18. {
  19. static public bool DefaultPDFLoaded = false;
  20. public static List<string> OpenedFilePathList = new List<string>();
  21. protected override void OnStartup(StartupEventArgs e)
  22. {
  23. string str = this.GetType().Assembly.Location;
  24. base.OnStartup(e);
  25. LicenseVerify();
  26. }
  27. private static bool LicenseVerify()
  28. {
  29. bool result = false;
  30. result = CPDFSDKVerifier.LoadNativeLibrary();
  31. if (!result)
  32. return false;
  33. SDKLicenseHelper sdkLicenseHelper = new SDKLicenseHelper();
  34. LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(sdkLicenseHelper.key, sdkLicenseHelper.secret);
  35. if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
  36. return false;
  37. return result;
  38. }
  39. }
  40. }