From 794e8cba6af8fc33146bf34caa6940fcaab5f42f Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期五, 04 四月 2025 17:35:12 +0800 Subject: [PATCH] 打印按钮 --- DevApp/Gs.DevApp/Program.cs | 68 +++++++++++++++++++++++---------- 1 files changed, 47 insertions(+), 21 deletions(-) diff --git a/DevApp/Gs.DevApp/Program.cs b/DevApp/Gs.DevApp/Program.cs index 33fe5ca..3459e3d 100644 --- a/DevApp/Gs.DevApp/Program.cs +++ b/DevApp/Gs.DevApp/Program.cs @@ -1,34 +1,60 @@ -锘縰sing DevExpress.LookAndFeel; -using DevExpress.Skins; -using DevExpress.UserSkins; -using System; -using System.Collections.Generic; -using System.Linq; +锘縰sing 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 { - static class Program + internal static class Program { /// <summary> - /// The main entry point for the application. + /// The main entry point for the application. /// </summary> [STAThread] - static void Main() + private static void Main() { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - //Application.Run(new Gs.DevApp.TestForm.FluentDesignForm1()); - //Application.Run(new Gs.DevApp.DevFrm.BasicData.FrmMesItems()); - DevFrm.FrmLogin fmLogin = new DevFrm.FrmLogin(); - fmLogin.ShowDialog(); - if (fmLogin.DialogResult == DialogResult.OK) + var processName = + Path.GetFileNameWithoutExtension(Process.GetCurrentProcess() + .MainModule.FileName); + var processes = Process.GetProcessesByName(processName); + if (processes.Length > 1) { - //鍦ㄧ嚎绋嬩腑鎵撳紑涓荤獥浣� - Application.Run(new DevFrm.FrmMain()); + MessageBox.Show("绋嬪簭宸茬粡鍦ㄨ繍琛岋紒"); + Environment.Exit(0); + } + else + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + _startLogin(); + } + } + + /// <summary> + /// 鐧诲綍椤靛惎鍔� + /// </summary> + private static void _startLogin() + { + //Application.Run(new XtraForm1()); + //return; + 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(); } } } - - -} +} \ No newline at end of file -- Gitblit v1.9.3