Program.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using System.Windows.Forms;
  6. namespace HRT_Measure
  7. {
  8. internal static class Program
  9. {
  10. /// <summary>
  11. /// 应用程序的主入口点。
  12. /// </summary>
  13. [STAThread]
  14. static void Main()
  15. {
  16. // 中文授权示例
  17. if (!HslCommunication.Authorization.SetAuthorizationCode("8cb26b16-6848-46b8-a9e4-6f57336b2872"))
  18. {
  19. MessageBox.Show("授权失败!当前程序只能使用24小时!");
  20. return; // 激活失败就退出系统
  21. }
  22. bool isRuned;
  23. System.Threading.Mutex mutex = new System.Threading.Mutex(true, "OnlyRunOneInstance", out isRuned);
  24. if (isRuned)
  25. {
  26. Application.EnableVisualStyles();
  27. Application.SetCompatibleTextRenderingDefault(false);
  28. Application.Run(new FrmMain());
  29. mutex.ReleaseMutex();
  30. }
  31. else
  32. {
  33. MessageBox.Show("程序已启动!\r\nThe program has started", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
  34. }
  35. }
  36. }
  37. }