App.xaml.cs 954 B

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