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

53 lines
1.6 KiB
C#

10 months ago
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;
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[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());
}
}
}
}