|
using DevExpress.LookAndFeel;
|
using DevExpress.XtraEditors;
|
using IStation.DataProvider;
|
using IStation.Desktop.CurveMgr;
|
using System;
|
using System.Collections.Generic;
|
using System.Windows.Forms;
|
|
namespace IStation
|
{
|
internal static class Program
|
{
|
[STAThread]
|
static void Main()
|
{
|
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 += Application_ThreadException;
|
//´¦Àí·ÇUIÏß³ÌÒì³£
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
|
Application.EnableVisualStyles();
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
|
System.Windows.Forms.Application.EnableVisualStyles();
|
System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
|
|
//IStation.LogHelper.Initial();
|
|
//×ÖÌå
|
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);
|
|
//³õʼ»¯Ñ©»¨Id
|
SnowflakeIdHelper.SetIdGenerator(1);
|
|
//Êý¾Ý³õʼ»¯
|
if (!Settings.File.Initialize)
|
{
|
ElecPriceGenerator.Creater();
|
StationGenerator.Creater();
|
|
Settings.File.Initialize = true;
|
SettingsHelper.Save();
|
}
|
|
//
|
IStation.BLL.RiverWaterLevelDrop.Initial();
|
IStation.BLL.ReservoirParas.Initial();
|
IStation.BLL.AnaSetting.Initial();
|
|
|
|
|
var frmMain = new frmMain();
|
frmMain.Initial();
|
Application.Run(frmMain);
|
}
|
|
|
///<summary>
|
/// Õâ¾ÍÊÇÎÒÃÇÒªÔÚ·¢Éúδ´¦ÀíÒ쳣ʱ´¦ÀíµÄ·½·¨£¬ÎÒÕâÊÇд³ö´íÏêϸÐÅÏ¢µ½Îı¾£¬Èç³ö´íºóµ¯³öÒ»¸öƯÁÁµÄ³ö´íÌáʾ´°Ì壬¸ø´ó¼Ò×ö¸ö²Î¿¼
|
/// ×ö·¨ºÜ¶à£¬¿ÉÒÔÊǰѳö´íÏêϸÐÅÏ¢¼Ç¼µ½Îı¾¡¢Êý¾Ý¿â£¬·¢Ëͳö´íÓʼþµ½×÷ÕßÐÅÏä»ò³ö´íºóÖØÐ³õʼ»¯µÈµÈ
|
/// Õâ¾ÍÊÇÈÊÕß¼ûÈÊÖÇÕß¼ûÖÇ£¬´ó¼Ò×Ô¼º×öÁË¡£
|
///</summary>
|
///<param name="sender"> </param>
|
///<param name="e"> </param>
|
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
{
|
var ex = e.Exception;
|
XtraMessageBox.Show($"ϵͳ³öÏÖδ֪Òì³££¬ÇëÖØÆôϵͳ£¡\r\n{ex.Message}");
|
}
|
|
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
{
|
var ex = e.ExceptionObject as Exception;
|
XtraMessageBox.Show($"ϵͳ³öÏÖδ֪Òì³££¬ÇëÖØÆôϵͳ£¡\r\n{ex?.Message}");
|
}
|
}
|
}
|