using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using MailAnalyzeTools.Common; namespace MailAnalyzeTools { static class Program { static bool isAppRunning; private static System.Threading.Mutex mutex; /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { // // Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); isAppRunning = false; mutex = new System.Threading.Mutex(true, "MailAnalyzeTools.exe", out isAppRunning); try { if (isAppRunning) { LogHelper.WriteLog("邮件分析及处理服务器重新启动:", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Application.Run(new frmAnalyzeMail()); } else { MessageBox.Show("本程序已经在运行了,请不要重复运行!", "信息提示"); Environment.Exit(1); } } catch (Exception ex) { //TODO:log System.Diagnostics.Debug.Print(ex.Message); LogHelper.WriteLog("邮件分析及处理服务器异常重新启动:", ex.Message); LogHelper.WriteLog(typeof(frmAnalyzeMail), ex); Application.Run(new frmAnalyzeMail()); } } } }