App.xaml.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. using static ComPDFKit.NativeMethod.CPDFSDKVerifier;
  13. namespace DocsEditControl
  14. {
  15. /// <summary>
  16. /// App.xaml 的交互逻辑
  17. /// </summary>
  18. public partial class App : Application
  19. {
  20. protected override void OnStartup(StartupEventArgs e)
  21. {
  22. string str = this.GetType().Assembly.Location;
  23. base.OnStartup(e);
  24. LicenseVerify();
  25. }
  26. private static bool LicenseVerify()
  27. {
  28. bool result = LoadNativeLibrary();
  29. if (!result)
  30. return false;
  31. SDKLicenseHelper sdkLicenseHelper = new SDKLicenseHelper();
  32. LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(sdkLicenseHelper.key, sdkLicenseHelper.secret);
  33. if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
  34. return false;
  35. return result;
  36. }
  37. }
  38. }