lu
2024-10-25 fe09fca3e77be09fed738a975ff9c5a508c2dd0d
DevApp/Gs.DevApp/Program.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace Gs.DevApp
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            var processName = System.IO.Path.GetFileNameWithoutExtension(System.Diagnostics.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();
            }
        }
        /// <summary>
        /// ç™»å½•页启动
        /// </summary>
        private static void _startLogin()
        {
            //Application.Run(new TestForm.XtraForm1());
            //return;
            DevFrm.FrmLogin fmLogin = new DevFrm.FrmLogin();
            if (fmLogin.IsDisposed == false)
            {
                fmLogin.ShowDialog();
                if (fmLogin.DialogResult == DialogResult.OK)
                {
                    Application.Run(new DevFrm.FrmMain());
                }
            }
            else
                Application.Exit();
        }
    }
}