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.Reflection;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Xml;
  12. namespace Forms
  13. {
  14. public partial class App : Application
  15. {
  16. protected override void OnStartup(StartupEventArgs e)
  17. {
  18. string str = this.GetType().Assembly.Location;
  19. base.OnStartup(e);
  20. LicenseVerify();
  21. }
  22. private static bool LicenseVerify()
  23. {
  24. bool result = CPDFSDKVerifier.LoadNativeLibrary();
  25. if (!result)
  26. return false;
  27. SDKLicenseHelper sdkLicenseHelper = new SDKLicenseHelper();
  28. LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(sdkLicenseHelper.key, sdkLicenseHelper.secret);
  29. if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
  30. return false;
  31. return result;
  32. }
  33. }
  34. }