using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace Pms.View { static class Program { /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { bool createNew; using (Mutex mutex = new Mutex(true, Application.ProductName, out createNew)) { if (createNew) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } else { Assembly ass = Assembly.GetExecutingAssembly(); AssemblyName assName = ass.GetName(); // 程序已经运行,显示提示后退出 MessageBox.Show(string.Format("{0}正在运行!\r\n{0} Has Been Opened!", assName.Name), "错误 Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }