using DevExpress.XtraEditors; namespace IStation.Win.View { internal class Program { static void Main(string[] args) { using (var mutex = new System.Threading.Mutex(true, Application.ProductName, out bool createNew)) { if (!createNew) { MessageBox.Show("程序正在运行中..."); Application.Exit(); return; } } //处理未捕获的异常 Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); //处理UI线程异常 Application.ThreadException += (sender, e) => { var ex = e.Exception; XtraMessageBox.Show($"系统出现未知异常,请重启系统!\r\n{ex.Message}"); }; //处理非UI线程异常 AppDomain.CurrentDomain.UnhandledException += (sender, e) => { if (e.ExceptionObject is Exception ex) { XtraMessageBox.Show($"系统出现未知异常,请重启系统!\r\n{ex.Message}"); } }; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.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(DevExpress.LookAndFeel.SkinStyle.WXICompact); // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); Application.Run(new viweMian()); } } }