Winfrom 重新登录

private void ReLogin_Click(object sender, EventArgs e)
        {
            ///实例化一个进程
            Process process = new Process();
 
            ///设置进程的应用程序
            process.StartInfo.FileName = System.AppDomain.CurrentDomain.BaseDirectory.ToString()+"QueryMachine.exe";
 
            ///启动指定的进程资源
            process.Start();
 
            ///终止正在进行的应用程序
            Application.Exit();
            bool flag = false;
 
            ///实例化一个同步基元
            Mutex mutex = new Mutex(true, "QueryMachine.BackManager.frmLogin", out flag);
            if (flag)
            {
                frmLogin Login = new frmLogin();
                
                if (Login.ShowDialog() == DialogResult.OK)
                {
                    Application.Run(new frmMDIMain());
                }
            }
            else
            {
                MessageBox.Show(resourceAlreadyRunning,resourceSystemTip, MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }
        }

  

posted on 2015-11-17 00:18  记性特差  阅读(273)  评论(0编辑  收藏  举报