using System; using System.Diagnostics; using System.IO; using System.Windows.Forms; using CefSharp.WinForms; using CefSharp; using Gs.DevApp.DevFrm; using DevExpress.XtraEditors; namespace Gs.DevApp { internal static class Program { /// /// The main entry point for the application. /// [STAThread] private static void Main() { var processName = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess() .MainModule.FileName); var processes = Process.GetProcessesByName(processName); if (processes.Length > 1) { MessageBox.Show("程序已经在运行!"); Environment.Exit(0); } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); _startLogin(); } } /// /// 登录页启动 /// private static void _startLogin() { //Application.Run(RibbonForm1()); //return; #region 设置默认字体、日期格式、汉化dev //DevExpress.Utils.AppearanceObject.DefaultFont = new System.Drawing.Font("宋体", 10); //DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont = new System.Drawing.Font("宋体", 10); //DevExpress.XtraEditors.WindowsFormsSettings.DefaultMenuFont = new System.Drawing.Font("宋体", 10); //DevExpress.XtraEditors.WindowsFormsSettings.DefaultPrintFont = new System.Drawing.Font("宋体", 10); #endregion CefSettings settings = new CefSettings(); settings.Locale = "zh-CN"; Cef.Initialize(settings); var fmLogin = new FrmLogin(); if (fmLogin.IsDisposed == false) { fmLogin.ShowDialog(); if (fmLogin.DialogResult == DialogResult.OK) Application.Run(new FrmMain()); } else { Application.Exit(); } } } }