锐腾搅拌上料功能
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.

64 lines
2.2 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using System.Diagnostics;
  6. using System.Reflection;
  7. using ICSSoft.Base.Language.Tool;
  8. using ICSSoft.Base.UserControl.MessageControl;
  9. namespace ICSSoft.Frame.Main.Entrance
  10. {
  11. static class Program
  12. {
  13. public static System.Threading.Mutex Run;
  14. /// <summary>
  15. /// 应用程序的主入口点。
  16. /// </summary>
  17. [STAThread]
  18. static void Main()
  19. {
  20. bool noRun = false;
  21. Run = new System.Threading.Mutex(true, Application.ProductName, out noRun);
  22. Application.EnableVisualStyles();
  23. Application.SetCompatibleTextRenderingDefault(false);
  24. System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN");
  25. var res=DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.SelfSkin).Assembly);
  26. if (noRun)
  27. {
  28. //未运行
  29. Run.ReleaseMutex();
  30. Application.Run(new FormLoginNew());
  31. }
  32. else
  33. {
  34. List<LangObj> langList = new List<LangObj>();
  35. LangObj obj = new LangObj();
  36. obj.LConvertString = "该系统已经有一个实例在运行,无法再次运行!";
  37. obj.LParameters = new object[] { };
  38. langList.Add(obj);
  39. MessageDialog dialog = new MessageDialog(1, langList);
  40. dialog.ShowDialog();
  41. }
  42. }
  43. private static Process RuningInstance()
  44. {
  45. Process currentProcess = Process.GetCurrentProcess();
  46. Process[] Processes = Process.GetProcessesByName(currentProcess.ProcessName);
  47. foreach (Process process in Processes)
  48. {
  49. if (process.Id != currentProcess.Id)
  50. {
  51. if (Assembly.GetExecutingAssembly().Location.Replace("/", "\\") == currentProcess.MainModule.FileName)
  52. {
  53. return process;
  54. }
  55. }
  56. }
  57. return null;
  58. }
  59. }
  60. }