App.xaml.cs 1.1 KB

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