コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (Form_Register reg = new Form_Register())
     {
         this.Hide();
         reg.ShowDialog();
         this.Show();
     }
 }
コード例 #2
0
        private async void button6_Click(object sender, EventArgs e)
        {
            string userID      = textBox1.Text;
            string password    = textBox2.Text;
            string passwordMD5 = MD5Encrypt(password);

            if (userID.Length == 0 || userID == "单行输入")
            {
                DialogResult result;
                using (Form_Tips tip = new Form_Tips("提示", "用户ID为空,是否注册新账号"))
                {
                    tip.ShowDialog();
                    result = tip.DialogResult;
                }
                if (result == DialogResult.Yes)
                {
                    using (Form_Register reg = new Form_Register())
                    {
                        this.Hide();
                        reg.ShowDialog();
                        this.Show();
                    }
                }
            }
            else
            {
                if (password.Length == 0 || password == "单行输入")
                {
                    using (Form_Tips tip = new Form_Tips("提示", "请输入密码!"))
                    {
                        tip.ShowDialog();
                    }
                }
                else
                {
                    try
                    {
                        string url    = baseUrl + "/login?Uid=" + userID + "&password="******"");

                        if (result.IsSuccessStatusCode)
                        {
                            using (Form_TripNote tn = new Form_TripNote(int.Parse(userID)))
                            {
                                tn.changePanel = tn.AddControlsToPanel;
                                this.Hide();
                                tn.ShowDialog();
                                textBox1.Text = "";
                                textBox2.Text = "";
                            }
                            this.Show();
                        }
                        else
                        {
                            using (Form_Tips tip = new Form_Tips("警告", "用户名或密码输入错误"))
                            {
                                tip.ShowDialog();
                            }
                        }
                    }
                    catch (Exception e1)
                    {
                        using (Form_Tips tip = new Form_Tips("警告", e1.Message))
                        {
                            tip.ShowDialog();
                        }
                    }
                }
            }
        }