Files
lserp_cs_6.0/其他程序/Lskj.CensorModule/Program.cs
T
cyf ab56a9bcf7 基线 SVN r240
SVN-Revision: r240
2025-02-06 06:46:06 +00:00

74 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using DevExpress.UserSkins;
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using System.Threading;
using Lskj.Control;
using Lskj.Util;
namespace CensorModule
{
static class Program
{
/// <summary>
/// 是否退出应用程序
/// </summary>
static bool glExitApp = false;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
BonusSkins.Register();
SkinManager.EnableFormSkins();
UserLookAndFeel.Default.SetSkinStyle("DevExpress Style");
//处理未捕获的异常
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
//处理UI线程异常
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
//处理非UI线程异常
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.Run(new FrmMain());
glExitApp = true;//标志应用程序可以退出
}
/// <summary>
/// <para>说明:处理异常</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-11-22 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="ThreadExceptionEventArgs"/> instance containing the event data.</param>
static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
MessageUtil.Show(e.Exception);
LogHelper.Instance.WriteError(e.Exception);
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
MessageUtil.Show(e.ExceptionObject.ToString());
while (true)
{//循环处理,否则应用程序将会退出
if (glExitApp)
{//标志应用程序可以退出,否则程序退出后,进程仍然在运行
MessageUtil.Show(e.ExceptionObject.ToString());
return;
}
System.Threading.Thread.Sleep(2 * 1000);
};
}
}
}