App.xaml.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using ComPDFKit.NativeMethod;
  2. using Compdfkit_Tools.Helper;
  3. using System.IO;
  4. using System.Reflection;
  5. using System.Windows;
  6. using System.Xml;
  7. using static ComPDFKit.NativeMethod.CPDFSDKVerifier;
  8. namespace Viewer
  9. {
  10. /// <summary>
  11. /// Interaction logic for App.xaml
  12. /// </summary>
  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 = 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. }