App.xaml.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using ComPDFKit.NativeMethod;
  2. using Compdfkit_Tools.Helper;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Configuration;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. namespace DigitalSignature
  11. {
  12. /// <summary>
  13. /// App.xaml 的交互逻辑
  14. /// </summary>
  15. public partial class App : Application
  16. {
  17. protected override void OnStartup(StartupEventArgs e)
  18. {
  19. base.OnStartup(e);
  20. LicenseVerify();
  21. }
  22. private static bool LicenseVerify()
  23. {
  24. bool result = false;
  25. result = CPDFSDKVerifier.LoadNativeLibrary();
  26. if (!result)
  27. return false;
  28. SDKLicenseHelper sdkLicenseHelper = new SDKLicenseHelper();
  29. LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(sdkLicenseHelper.key, sdkLicenseHelper.secret);
  30. if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
  31. return false;
  32. return result;
  33. }
  34. }
  35. }