Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            groupBox1.Enabled = false;
            //配置文件读取类
            Readfile.Readfile cfg = new Readfile.Readfile();

            button1.Enabled = false;
            //检验用户名和密码
            string user = cfg.GetConfig(Application.StartupPath + "/Database/PWD.mdb", "username");
            string pwd  = cfg.GetConfig(Application.StartupPath + "/Database/PWD.mdb", "userpassword");

            if (GetMd6Str(textBox1.Text) == user && GetMd6Str(textBox2.Text) == pwd)
            {
                this.Focus();
                //改变鼠标形状
                this.Cursor          = System.Windows.Forms.Cursors.WaitCursor;
                progressBar1.Visible = true;
                button1.Visible      = false;
                timer1.Enabled       = true;
                backgroundWorker1.RunWorkerAsync();
                //启用socket
                if (cfg.GetConfig(Application.StartupPath + "/config.ini", "enable") == "true")
                {
                    sck sock = new sck();
                    //读取线程数量
                    sock.listen(int.Parse(cfg.GetConfig(Application.StartupPath + "/config.ini", "ThreadNum")),
                                int.Parse(cfg.GetConfig(Application.StartupPath + "/config.ini", "port")));
                }
                else
                {
                    server.text = "未开启后台服务";
                }
            }
            else
            {
                label3.Text    = "用户名或密码错误";
                timer2.Enabled = true;
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            groupBox1.Enabled =false ;
            //配置文件读取类
            Readfile.Readfile cfg = new Readfile.Readfile();

            button1.Enabled = false;
            //检验用户名和密码
            string user=cfg.GetConfig(Application.StartupPath + "/Database/PWD.mdb", "username");
            string pwd = cfg.GetConfig(Application.StartupPath + "/Database/PWD.mdb", "userpassword");

            if (GetMd6Str(textBox1.Text) == user && GetMd6Str(textBox2.Text) == pwd)
            {
            this.Focus();
            //改变鼠标形状
            this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
            progressBar1.Visible = true;
            button1.Visible = false;
            timer1.Enabled = true;
            backgroundWorker1.RunWorkerAsync();
            //启用socket
            if(cfg.GetConfig(Application.StartupPath + "/config.ini", "enable")=="true")
                {
                sck sock = new sck();
                //读取线程数量
                sock.listen(int.Parse(cfg.GetConfig(Application.StartupPath + "/config.ini", "ThreadNum")),
                int.Parse(cfg.GetConfig(Application.StartupPath + "/config.ini", "port")));
                }
                else
                {
                    server.text="未开启后台服务";}
            }
            else
            {
                label3.Text = "用户名或密码错误";
                timer2.Enabled = true;
            }
        }