using DevExpress.LookAndFeel;
using Mapster;
using System.Reflection;
namespace HStation.Desktop
{
internal static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
private static void Main()
{
using (var mutex = new System.Threading.Mutex(true, Application.ProductName, out bool createNew))
{
if (!createNew)
{
MessageBox.Show("³ÌÐòÕýÔÚÔËÐÐÖÐ...");
Application.Exit();
return;
}
//DevExpress.UserSkins.BonusSkins.Register();
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Bezier");//Visual Studio 2013 Light
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(SkinSvgPalette.Bezier.OfficeColorful);
DevExpress.Skins.SkinManager.EnableFormSkins();
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Ïß³ÌÒì³£
//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);
//DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(SkinStyle.WXICompact);
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
//if (!LoginHelper.Login())
//{
// return;
//}
// Yw.FileFolderZipHelper.Zip(@"C:\Users\ZKC\Desktop\Ñ»·Ë®ÓÃÀý", @"C:\Users\ZKC\Desktop\Ñ»·Ë®ÓÃÀý.ywrvt");
//Yw.FileFolderZipHelper.Zip(@"C:\Users\Eventech\Desktop\Ñ»·Ë®ÓÃÀý", @"C:\Users\Eventech\Desktop\Ñ»·Ë®ÓÃÀý.ywrvt");
// Yw.FileFolderZipHelper.Zip(@"C:\Users\admin\Desktop\¾Ó¼Ò°ì¹«¹¤×÷\Ñ»·Ë®ÓÃÀý", @"C:\Users\admin\Desktop\¾Ó¼Ò°ì¹«¹¤×÷\Ñ»·Ë®ÓÃÀý.ywrvt");
//Yw.FileFolderZipHelper.Zip(@"C:\Users\admin\Desktop\¾Ó¼Ò°ì¹«¹¤×÷\¼òµ¥ÓÃÀý", @"C:\Users\admin\Desktop\¾Ó¼Ò°ì¹«¹¤×÷\¼òµ¥ÓÃÀý.ywrvt");
//var json = RevitTestHelper.GenerateJson();
//var jsonFileName = @"C:\Users\admin\Desktop\¾Ó¼Ò°ì¹«¹¤×÷\¶þ¿ªÑ¹ËõÎļþ\hydro.json";
//var jsonContent = File.ReadAllText(jsonFileName);
//var jsonModel = JsonHelper.Json2Object(jsonContent);
//ɨÃèÈ«¾ÖDTOÓ³Éä
TypeAdapterConfig.GlobalSettings.Scan
(
Assembly.Load("Yw.BLL.Auth.Core"),
Assembly.Load("Yw.BLL.Bimface.Core"),
Assembly.Load("Yw.BLL.Hydro.Core"),
Assembly.Load("Yw.BLL.Map.Core"),
Assembly.Load("HStation.BLL.Xhs.Core")
);
DbFirstHelper.Initial();
Yw.WinFrmUI.GlobalParas.AppIcon = HStation.Desktop.Xhs.Core.Properties.Resources.app;
Application.Run(new MainForm());
}
}
///
/// Õâ¾ÍÊÇÎÒÃÇÒªÔÚ·¢Éúδ´¦ÀíÒ쳣ʱ´¦ÀíµÄ·½·¨£¬ÎÒÕâÊÇд³ö´íÏêϸÐÅÏ¢µ½Îı¾£¬Èç³ö´íºóµ¯³öÒ»¸öƯÁÁµÄ³ö´íÌáʾ´°Ì壬¸ø´ó¼Ò×ö¸ö²Î¿¼
/// ×ö·¨ºÜ¶à£¬¿ÉÒÔÊǰѳö´íÏêϸÐÅÏ¢¼Ç¼µ½Îı¾¡¢Êý¾Ý¿â£¬·¢Ëͳö´íÓʼþµ½×÷ÕßÐÅÏä»ò³ö´íºóÖØÐ³õʼ»¯µÈµÈ
/// Õâ¾ÍÊÇÈÊÕß¼ûÈÊÖÇÕß¼ûÖÇ£¬´ó¼Ò×Ô¼º×öÁË¡£
///
///
///
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
var ex = e.Exception;
Yw.LogHelper.Error("ϵͳ³öÏÖδ֪Òì³£,ERROR:249", ex);
MessageBox.Show($"ϵͳ³öÏÖδ֪Òì³££¬ÇëÖØÆôϵͳ£¡\r\n{ex.Message}");
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var ex = e.ExceptionObject as Exception;
Yw.LogHelper.Error("ϵͳ³öÏÖδ֪Òì³£,ERROR:255", ex);
MessageBox.Show($"ϵͳ³öÏÖδ֪Òì³££¬ÇëÖØÆôϵͳ£¡\r\n{ex.Message}");
}
}
}