duheng
2024-06-20 ff6113a18eaef4f601daa4594750e1189a566125
Desktop/HStation.DeskTop.Xhs.Main/Program.cs
@@ -7,13 +7,13 @@
namespace HStation.Desktop
{
    static class Program
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        private static void Main()
        {
            using (var mutex = new System.Threading.Mutex(true, Application.ProductName, out bool createNew))
            {
@@ -31,29 +31,38 @@
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-Hans");
                System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-Hans");
                //处理未捕获的异常
                //处理未捕获的异常
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                //处理UI线程异常
                Application.ThreadException += Application_ThreadException;
                //处理非UI线程异常
                //处理非UI线程异常
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                //字体
                var font = new System.Drawing.Font("微软雅黑", 10);
                DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont = font;
                DevExpress.XtraEditors.WindowsFormsSettings.DefaultMenuFont = font;
                DevExpress.Utils.AppearanceObject.DefaultFont = font;
                //zh-Hans界面翻译
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-Hans");
                System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-Hans");
                //皮肤
                DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(SkinStyle.WXICompact);
                //扫描全局DTO映射
                TypeAdapterConfig.GlobalSettings.Scan(Assembly.Load("Yw.BLL.Auth.Core"), Assembly.Load("HStation.BLL.Xhs.Core"));
                var loginHelper = new LoginHelper();
                if (!loginHelper.Login())
                    return;
                Application.Run(new MainFrm());
                Application.Run(new GuideMain());
            }
        }
        ///<summary>
        ///  这就是我们要在发生未处理异常时处理的方法,我这是写出错详细信息到文本,如出错后弹出一个漂亮的出错提示窗体,给大家做个参考
@@ -75,6 +84,5 @@
            Yw.LogHelper.Error("系统出现未知异常,ERROR:255", ex);
            MessageBox.Show($"系统出现未知异常,请重启系统!\r\n{ex.Message}");
        }
    }
}
}