コード例 #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //读ini文件如果存在且正确,直接进入server,否则转入登陆
            if (System.IO.File.Exists(Environment.CurrentDirectory + "\\ServerInfo.ini") == false)
            {
                //创建配置窗口
                Login_Form login_forn = new Login_Form();
                login_forn.Text = "服务器配置";

                if (login_forn.ShowDialog() == DialogResult.OK)
                {
                    login_forn.Dispose();//释放login_form的所有资源
                    Wellcome wellcom_form = new Wellcome();
                    if (wellcom_form.ShowDialog() == DialogResult.OK)
                    {
                        //wellcom_form.
                        wellcom_form.Dispose();//释放login_form的所有资源
                        Application.Run(new F_Server());
                    }
                    else
                    {
                        wellcom_form.Dispose();
                        //MessageBox.Show("退出服务器");
                        Application.Exit();
                    }
                }
                else
                {
                    login_forn.Dispose();
                    //MessageBox.Show("退出服务器");
                    Application.Exit();
                }
            }
            else  //当前目录下已存在INI文件

            {
                Wellcome wellcom_form = new Wellcome();
                if (wellcom_form.ShowDialog() == DialogResult.OK)
                {
                    wellcom_form.Dispose();//释放login_form的所有资源
                    Application.Run(new F_Server());
                }
                else
                {
                    wellcom_form.Dispose();
                    //MessageBox.Show("退出服务器");
                    Application.Exit();
                }
                //Application.Run(new F_Server());
                //Application.Run(new Wellcome());
            }
        }
コード例 #2
0
        /*
         *
         * 点击配置,弹出配置窗口
         *
         *
         * */
        private void config_Click(object sender, EventArgs e)
        {
            //创建配置窗口
            Login_Form login_forn = new Login_Form();

            login_forn.Text = "服务器配置";

            if (login_forn.ShowDialog() == DialogResult.OK)
            {
                login_forn.Dispose();//释放login_form的所有资源
                MessageBox.Show("配置成功,重启生效!");
                //Application.Run(new F_Server());
            }
            else
            {
                login_forn.Dispose();
                //MessageBox.Show("退出配置");
                //Application.Exit();
            }
        }