예제 #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Process[] processArray = Process.GetProcesses();
            int       currentCount = 0;

            foreach (var item in processArray)
            {
                if (item.ProcessName == Process.GetCurrentProcess().ProcessName)
                {
                    currentCount++;
                }
                if (currentCount > 1)
                {
                    MessageBox.Show("当前系统已启动", "提示信息");
                    Application.Exit();
                    return;
                }
            }
            FrmAdminLogin frmLogin = new FrmAdminLogin();
            DialogResult  result   = frmLogin.ShowDialog();

            if (result == DialogResult.OK)
            {
                Application.Run(new FrmMain());
            }
            else
            {
                Application.Exit();
            }
        }
예제 #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            FrmAdminLogin adminLogin = new FrmAdminLogin();
            DialogResult  resutl     = adminLogin.ShowDialog();

            if (resutl == DialogResult.OK)
            {
                Application.Run(new FrmMain());
            }
            else
            {
                Application.Exit();//退出整个应用程序
            }
        }