Exemplo n.º 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();
            }
        }
Exemplo n.º 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //显示登录窗体返回登录信息
            DialogResult result = new FrmAdminLogin().ShowDialog(); //启动登录窗体

            if (result == DialogResult.OK)                          //登录成功
            {
                Application.Run(new FrmMain());
            }
            else
            {
                Application.Exit();
            }
        }
Exemplo n.º 3
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();//退出整个应用程序
            }
        }