You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.5 KiB

2 years ago
  1. using System;
  2. using System.Diagnostics;
  3. using System.Windows.Forms;
  4. namespace Euro.Transfer
  5. {
  6. internal static class Program
  7. {
  8. /// <summary>
  9. /// 应用程序的主入口点。
  10. /// </summary>
  11. [STAThread]
  12. private static void Main()
  13. {
  14. var processCount = 0;
  15. var pa = Process.GetProcesses();//獲取當前進程數組。
  16. foreach (Process PTest in pa)
  17. {
  18. if (PTest.ProcessName == Process.GetCurrentProcess().ProcessName)
  19. {
  20. processCount += 1;
  21. }
  22. }
  23. if (processCount > 1)
  24. {
  25. //如果程序已經運行,則給出提示。並退出本進程。
  26. DialogResult dr;
  27. dr = MessageBox.Show("小助手已經運行!", "退出程序", MessageBoxButtons.OK, MessageBoxIcon.Error);
  28. //可能你不需要彈出窗口,在這裡可以屏蔽掉
  29. return; //Exit;
  30. }
  31. //GetOrig logFrm = new GetOrig();
  32. //if (logFrm.ShowDialog() == DialogResult.OK)//为第一次選擇公司
  33. //{
  34. // Application.Run(new WordTransfer()); //跳轉到小助手
  35. //}
  36. Application.EnableVisualStyles();
  37. Application.SetCompatibleTextRenderingDefault(false);
  38. using (var wordTransfer = new WordTransfer())
  39. {
  40. Application.Run(wordTransfer);
  41. }
  42. }
  43. }
  44. }